Skip to main content
Lesson 5 of 14 · Voxtral TTS: Voice Synthesis and Cloning

Create a Custom Voice

Lesson 5 of 14 Updated November 3, 2026 Developer
On this page
  1. From Recording to Cloned Voice
  2. Prepare Your Audio Sample
  3. Complete Python Code
  4. Record from the Browser
  5. Verify Your Voice
  6. Key Takeaways

Course updated November 3, 2026 for Voxtral TTS 3, based on the Migrate from Voxtral 2 guide and Mistral’s Text to Speech pages: voxtral-mini-tts-2603, deprecated October 31, 2026 and retired April 30, 2027, is replaced in examples by voxtral-mini-tts-3-0. Voxtral 2 predefined voices (gb_jane_neutral…) remain accepted; Voxtral 3 adds [emotion=…] and [pace=…] tags in text, the expressiveness setting, custom pronunciation (phoneme_hints), and 35 languages. Mistral recommends re-measuring latency after migration. Sources: Migrate from Voxtral 2 · Speech generation.

From Recording to Cloned Voice

Creating a custom voice with Voxtral comes down to two steps: prepare a high-quality audio sample, then send it to the API with the right parameters. The second step takes ten minutes; the first deserves more attention because it determines the result. This lesson walks you through creating your first voice.

Prepare Your Audio Sample

The audio sample is the foundation of your voice: its quality directly determines the quality of the synthesized speech. The model does not correct anything; it reproduces what it hears.

With Voxtral TTS 3, the documentation requests an MP3 or WAV recording lasting a few seconds to a few minutes (Voxtral 2 accepted 3 to 30 seconds). In practice, three regimes stand out. Between 3 and 10 seconds, the model captures the basic timbre but with fewer nuances: the voice will be recognizable without being truly lifelike. Between 10 and 20 seconds, you get a good compromise between quality and simplicity, sufficient for most projects. Beyond 20 seconds, you give the model enough material to grasp subtleties—rhythm, intonation, those micro-variations that let a friend recognize you in two words.

The remaining question is what to say, an issue that stalls more people than you might expect when it is time to hit record. Here is a reference script Mistral recommends:

“I am recording an audio sample to clone my voice. Once finished, I will be able to generate speech that sounds like me. It is incredible how AI can capture my way of speaking, my tone, my rhythm, and even the small quirks that make my voice unique.”

This text is not arbitrary: it is designed to cover a variety of sounds and intonations in English, with open and closed vowels, plosive consonants, and an exclamatory sentence. On the file side, the API accepts common formats—MP3, WAV, FLAC, OGG—and the file is base64-encoded before sending.

Complete Python Code

Here is the code to create a voice with all available parameters:

import base64
from pathlib import Path
from mistralai.client import Mistral

client = Mistral(api_key="your-api-key")

# Read and encode the audio sample
audio_path = Path("my-sample.mp3")
sample_audio_b64 = base64.b64encode(audio_path.read_bytes()).decode()

# Create the voice with all parameters
voice = client.audio.voices.create(
    name="podcast-narrator-en",
    sample_audio=sample_audio_b64,
    sample_filename=audio_path.name,
    languages=["en", "fr"],
    gender="male",
    age=40,
    tags=["podcast", "narrator", "professional"]
)

print(f"Voice created successfully!")
print(f"  ID : {voice.id}")
print(f"  Name : {voice.name}")
print(f"  Languages : {voice.languages}")

Only two parameters are required:

  • name: the display name of your voice. Choose a descriptive name that lets you identify it easily (e.g., support-assistant-en, podcast-intro)
  • sample_audio: the audio sample encoded in base64. This is the only parameter that cannot be modified after creation

The others are optional, but each serves a concrete purpose:

  • sample_filename: the original file name. Helps the API detect the audio format
  • slug: a URL-friendly identifier. If omitted, it is generated automatically from the name
  • languages: an array of ISO language codes (e.g., ["en", "fr", "es"]). Indicates the languages this voice is optimized for
  • gender: "male" or "female". Used for filtering in the interface
  • age: an integer representing the speaker’s approximate age. Helps categorize the voice
  • tags: an array of free-form strings to organize your voices (e.g., ["commercial", "dynamic"])

On a single-voice project, you might be tempted to omit everything. On a catalog of thirty voices spread across multiple clients, tags and languages specified at creation will save you hours of sorting.

Record from the Browser

If you prefer not to handle audio files, Mistral Studio lets you record directly from your browser:

  1. Go to the Audio > Text to Speech section
  2. Click My Voices then Add a new voice
  3. Enter your voice name
  4. Click the record button and speak for 10 to 30 seconds
  5. Confirm—your voice is immediately available

This method works perfectly for quick tests, or when the person lending their voice is not the one writing the code—an actor or executive will be more willing to do the exercise in a browser than in a terminal.

Verify Your Voice

Never move on without listening to the result. As soon as creation is complete, generate a test sentence:

response = client.audio.speech.complete(
    model="voxtral-mini-tts-3-0",
    input="Hello, this is a test of my custom voice.",
    voice_id=voice.id,
    response_format="mp3",
)

Path("test-voice.mp3").write_bytes(
    base64.b64decode(response.audio_data)
)
print("File test-voice.mp3 generated — listen to the result!")

Listen on headphones, not on laptop speakers: timbre defects are inaudible there. If the result does not satisfy you, create a new voice with a better sample rather than reusing the same one—the API does not allow replacing the audio of an existing voice anyway, and insisting on a poor recording will only postpone the problem.

Key Takeaways

  • The recording (MP3 or WAV) can last from a few seconds to a few minutes; aim for at least 10 to 20 seconds of varied speech
  • The audio file is base64-encoded before sending to the API
  • The name and sample_audio parameters are required; the others are optional
  • Mistral Studio lets you record directly from the browser
  • Always test your voice immediately after creation