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 support for Windows and Linux coming soon.

ollama run phonon "Hello from Ollama."
Voices Languages
    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 platform, delivering the fastest 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 and matches 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

    Select a voice using --voice or voice in the API:

    ollama run phonon --voice Hadley "Hello from Ollama."
    

    The voices are taken from the Gradium voice catalog. ollama show phonon lists them all.

    Languages

    [[T0]]

    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. 40M models are released under a CC BY-NC 4.0 license, which restricts their non-commercial use.

    Read the answers out loud

    Send your response to the chat model in Phonon. The text is spoken as it comes in, so the answer starts playing after the first sentence:

    ollama run gemma4 --hidethinking "Tell me a fun fact about owls in two sentences." | ollama run phonon
    

    Run ollama run phonon without text to enter strings on the command line, or redirect the output to save a WAV file:

    ollama run phonon "Save this to a file." > speech.wav
    

    API

    Phonon works with the /v1/audio/speech OpenAI-compatible endpoint, so existing code using the OpenAI SDK only needs a new base URL.

    cURL Python JavaScript
    curl http://localhost:11434/v1/audio/speech \
      -H "Content-Type: application/json" \
      -d '{
        "model": "phonon",
        "voice": "Zoey",
        "input": "Hello from Ollama."
      }' --output speech.wav
    from openai import OpenAI
    
    client = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
    
    with client.audio.speech.with_streaming_response.create(
        model="phonon",
        voice="Zoey",
        input="Hello from Ollama.",
        response_format="wav",
    ) as response:
        response.stream_to_file("speech.wav")
    import fs from "node:fs"
    import OpenAI from "openai"
    
    const openai = new OpenAI({ baseURL: "http://localhost:11434/v1", apiKey: "ollama" })
    
    const response = await openai.audio.speech.create({
      model: "phonon",
      voice: "Zoey",
      input: "Hello from Ollama.",
      response_format: "wav",
    })
    fs.writeFileSync("speech.wav", Buffer.from(await response.arrayBuffer()))

    The response is transmitted during sound generation, so it can be played back immediately:

    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 24kHz mono, returned in WAV format by default or as raw 16-bit samples using "response_format": "pcm".

    Start

    Speech models run on Apple Silicon Mac computers. Download Ollama 0.40.11 or later, then extract Phonon:

    ollama pull phonon
    

    For more information see:

    #SLM #LocalAI #Ollama #Gemma #GPU