Ollama 上线语音模型 Phonon,支持本地文本转语音
Speech models in Ollama
Ollama 宣布支持语音模型,首个上线的是 Gradium 的文本转语音模型 Phonon,目前可用于 macOS,Windows 和 Linux 支持即将推出。
Ollama can now turn text into speech. The first speech model is Phonon, a family of small, state-of-the-art text-to-speech models from Gradium. Speech models are now available for macOS, with Windows and Linux support coming soon.
ollama run phonon "Hello from Ollama."
Unedited output from Ollama 0.40.11 on a MacBook Pro with M5 Max.
Performance on Apple Silicon
On Apple Silicon, Ollama is accelerated by MLX, Apple’s machine learning framework, for state-of-the-art throughput. On a MacBook Pro with M5 Max, Ollama was 35% faster than the next fastest engine, Gradium’s own runtime.
Throughput
Times faster than real time
Measured on a MacBook Pro with M5 Max, generating 45 seconds of speech. Median of 10 runs. Gradium's own runtime, ptts, uses 8-bit weights on the CPU, fp16 on the Neural Engine and f32 on the GPU; Ollama runs the model in bf16.
Ollama’s implementation is just as accurate, matching the word error rate of the reference implementation in Hugging Face Transformers:
Accuracy
Word error rate
Lower is better. 200 sentences from the Seed-TTS English test set, transcribed with Whisper large-v3.
Voices
Choose a voice with --voice, or voice in the API:
ollama run phonon --voice Hadley "Hello from Ollama."
The voices come from Gradium’s voice catalog. ollama show phonon lists them all.
Languages
| Model | Language |
|---|---|
phonon |
English |
phonon:40m-fr |
French |
phonon:40m-de |
German |
phonon:40m-es |
Spanish |
phonon:40m-pt |
Portuguese |
phonon:40m-multilingual |
All five |
phonon is released under Apache 2.0. The 40M models are released under CC BY-NC 4.0, which limits them to noncommercial use.
Pipe a chat model’s reply into Phonon. Text is spoken as it arrives, so the reply starts playing after its first sentence:
ollama run gemma4 --hidethinking "Tell me a fun fact about owls in two sentences." | ollama run phonon
Run ollama run phonon with no text to type lines at a prompt, or redirect the output to save a WAV file:
ollama run phonon "Save this to a file." > speech.wav
API
Phonon works with the OpenAI-compatible /v1/audio/speech endpoint, so existing code that uses the OpenAI SDK only needs a new base URL.
curl http://localhost:11434/v1/audio/speech \
-H "Content-Type: application/json" \
-d '{
"model": "phonon",
"voice": "Zoey",
"input": "Hello from Ollama."
}' --output speech.wavThe response streams while the audio is generated, so it can play right away:
curl -sN http://localhost:11434/v1/audio/speech \
-H "Content-Type: application/json" \
-d '{"model": "phonon", "input": "Playback starts right away."}' \
| ffplay -nodisp -autoexit -loglevel error -
Audio is 24 kHz mono, returned as WAV by default or as raw 16-bit samples with "response_format": "pcm".
Get started
Speech models run on Apple Silicon Macs. Download Ollama 0.40.11 or later, then pull Phonon:
ollama pull phonon
For more information, see:
来源:Ollama:Blog · ollama.com