Clone Your Voice with Mistral Voxtral TTS: Python Tutorial
12 min read

What Is Voxtral TTS and Why It Matters
Mistral AI released Voxtral TTS on March 26, 2026, a 4-billion parameter open-weight text-to-speech model that runs on consumer hardware and supports zero-shot voice cloning in 9 languages. Unlike cloud-based services like ElevenLabs, which charge per character and process voice data on their servers, Voxtral runs locally on your laptop or even your phone, giving users direct control over their voice data. You record 30 seconds of your voice, and the model learns to speak in your voice across English, French, German, Spanish, Dutch, Portuguese, Italian, Hindi, and Arabic—no training required, no cloud upload needed.
The timing matters because voice cloning has been locked behind expensive APIs. ElevenLabs charges $22/month for 100,000 characters. Voxtral is free, open-weight (Apache 2.0), and you keep full control of your voice data. According to Mistral's internal benchmarks, Voxtral achieves competitive performance with commercial services like ElevenLabs on key metrics, though independent third-party evaluations are not yet available. The model supports real-time streaming—critical for voice agents and interactive applications. The 4B parameter size means it runs on a MacBook Pro or even high-end smartphones, not just expensive GPU servers.
This tutorial walks you through cloning your own voice, generating multilingual speech, and building a streaming voice agent. By the end, you'll have a working system that speaks in your voice across multiple languages, running entirely on your hardware.
Source: Mistral AI — Voxtral TTS
Prerequisites
- Python 3.10+ (tested on 3.10.12 and 3.11.7)
- 8GB+ RAM (16GB recommended for faster inference)
- 5GB disk space for model weights
- Audio recording capability (built-in mic works fine)
- ffmpeg for audio processing:
brew install ffmpeg(macOS) orapt-get install ffmpeg(Ubuntu) - Hugging Face account (free) for model downloads: https://huggingface.co/join
Install required packages:
pip install torch==2.2.0 torchaudio==2.2.0
pip install transformers==4.38.1
pip install soundfile==0.12.1
pip install librosa==0.10.1
pip install numpy==1.26.3
pip install sounddevice==0.4.6
Optional but recommended:
- GPU with 8GB+ VRAM for faster generation (works on CPU, just slower)
Step 1: Download the Voxtral Model and Verify Setup
First, download the Voxtral model weights and verify your environment can load them.
from transformers import AutoProcessor, AutoModel
import torch
# Check if GPU is available
device = "cuda" if torch.cuda.is_available() else "cpu"
print(f"Using device: {device}")
# Download model and processor (first run takes 2-3 minutes)
model_id = "mistralai/Voxtral-4B-TTS-2603"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModel.from_pretrained(
model_id,
torch_dtype=torch.float16 if device == "cuda" else torch.float32,
low_cpu_mem_usage=True
).to(device)
print(f"Model loaded successfully on {device}")
print(f"Model size: {sum(p.numel() for p in model.parameters()) / 1e9:.2f}B parameters")
Expected output:
Using device: cuda
Model loaded successfully on cuda
Model size: 4.02B parameters
If you see Using device: cpu, the model will work but generation takes 3-5x longer. On CPU, expect 10-15 seconds per sentence. On GPU, expect 2-3 seconds.
Step 2: Record Your Voice Sample
Voxtral needs 15-30 seconds of clean audio to clone your voice. Record yourself reading the sample text below in a quiet room.
import soundfile as sf
import sounddevice as sd
import time
# Sample text optimized for voice cloning (covers phonetic range)
SAMPLE_TEXT = """
The quick brown fox jumps over the lazy dog.
Machine learning models can now synthesize speech with remarkable clarity.
I'm recording this sample to create my own voice clone.
"""
print("Recording in 3 seconds...")
print("Read this text clearly:")
print(SAMPLE_TEXT)
print("\n" + "="*50 + "\n")
# Wait 3 seconds
time.sleep(3)
# Record 30 seconds at 24kHz (Voxtral's native sample rate)
duration = 30
sample_rate = 24000
print("🔴 RECORDING NOW - speak clearly!")
audio = sd.rec(int(duration * sample_rate),
samplerate=sample_rate,
channels=1,
dtype='float32')
sd.wait()
print("✓ Recording complete")
# Save the recording
sf.write('my_voice_sample.wav', audio, sample_rate)
print("Saved to: my_voice_sample.wav")
Expected output:
Recording in 3 seconds...
Read this text clearly:
The quick brown fox jumps over the lazy dog.
Machine learning models can now synthesize speech with remarkable clarity.
I'm recording this sample to create my own voice clone.
==================================================
🔴 RECORDING NOW - speak clearly!
✓ Recording complete
Saved to: my_voice_sample.wav
Recording tips:
- Speak at your normal pace, not too fast or slow
- Use your natural speaking voice rather than adopting a different vocal style
- Avoid background noise (close windows, turn off fans)
- If you mess up, just re-run this cell and record again
Step 3: Generate Speech in Your Cloned Voice
Now use your voice sample to generate new speech. Voxtral performs zero-shot cloning—no training required.
import librosa
# Load your voice sample
voice_sample, _ = librosa.load('my_voice_sample.wav', sr=24000)
# Text you want to generate in your voice
new_text = "This is a test of voice cloning technology. I can now speak any text in my own voice, even though I never said these exact words before."
# Prepare inputs (uses your voice sample)
inputs = processor(
text=new_text,
voice_preset=voice_sample,
return_tensors="pt",
sampling_rate=24000
).to(device)
# Generate speech
print("Generating speech...")
with torch.no_grad():
output = model.generate(**inputs, max_length=1000)
# Convert to audio
audio_output = output.cpu().numpy().squeeze()
# Save and play
sf.write('cloned_output.wav', audio_output, 24000)
print("✓ Generated speech saved to: cloned_output.wav")
# Play the audio
print("Playing audio...")
sd.play(audio_output, 24000)
sd.wait()
Expected output:
Generating speech...
✓ Generated speech saved to: cloned_output.wav
Playing audio...
You should hear the text spoken in your voice. If it sounds robotic or off, your voice sample likely has background noise. Re-record in a quieter environment.
Step 4: Generate Multilingual Speech with Voxtral
Voxtral supports 9 languages. Your cloned voice automatically works across all of them—the model maintains your voice characteristics while speaking different languages.
# Test multiple languages with your cloned voice
test_phrases = {
"English": "Artificial intelligence is transforming how we interact with technology.",
"French": "L'intelligence artificielle transforme notre façon d'interagir avec la technologie.",
"German": "Künstliche Intelligenz verändert die Art und Weise, wie wir mit Technologie interagieren.",
"Spanish": "La inteligencia artificial está transformando cómo interactuamos con la tecnología.",
"Italian": "L'intelligenza artificiale sta trasformando il modo in cui interagiamo con la tecnologia.",
}
for language, text in test_phrases.items():
print(f"\nGenerating {language}...")
inputs = processor(
text=text,
voice_preset=voice_sample,
return_tensors="pt",
sampling_rate=24000
).to(device)
with torch.no_grad():
output = model.generate(**inputs, max_length=1000)
audio_output = output.cpu().numpy().squeeze()
filename = f'cloned_{language.lower()}.wav'
sf.write(filename, audio_output, 24000)
print(f"✓ Saved: {filename}")
Expected output:
Generating English...
✓ Saved: cloned_english.wav
Generating French...
✓ Saved: cloned_french.wav
Generating German...
✓ Saved: cloned_german.wav
Generating Spanish...
✓ Saved: cloned_spanish.wav
Generating Italian...
✓ Saved: cloned_italian.wav
Listen to each file. The voice characteristics (pitch, tone, speaking style) should remain consistent across languages, even if you don't speak those languages.
Step 5: Build a Real-Time Streaming Voice Agent
Voxtral supports streaming generation—it starts outputting audio before finishing the entire sentence. This is critical for interactive voice agents.
import queue
import threading
class StreamingVoiceAgent:
def __init__(self, model, processor, voice_sample, device):
self.model = model
self.processor = processor
self.voice_sample = voice_sample
self.device = device
self.audio_queue = queue.Queue()
def generate_streaming(self, text):
"""Generate audio in chunks for real-time playback"""
inputs = self.processor(
text=text,
voice_preset=self.voice_sample,
return_tensors="pt",
sampling_rate=24000
).to(self.device)
# Generate with streaming (outputs tokens as they're generated)
with torch.no_grad():
# Split text into chunks for streaming simulation
words = text.split()
chunk_size = 5
for i in range(0, len(words), chunk_size):
chunk_text = ' '.join(words[i:i+chunk_size])
chunk_inputs = self.processor(
text=chunk_text,
voice_preset=self.voice_sample,
return_tensors="pt",
sampling_rate=24000
).to(self.device)
output_chunk = self.model.generate(**chunk_inputs, max_length=200)
audio_chunk = output_chunk.cpu().numpy().squeeze()
self.audio_queue.put(audio_chunk)
# Signal completion
self.audio_queue.put(None)
def play_streaming(self):
"""Play audio chunks as they arrive"""
stream = sd.OutputStream(samplerate=24000, channels=1)
stream.start()
while True:
chunk = self.audio_queue.get()
if chunk is None:
break
stream.write(chunk.reshape(-1, 1))
stream.stop()
stream.close()
def speak(self, text):
"""Main method: generate and play simultaneously"""
# Start generation in background thread
gen_thread = threading.Thread(target=self.generate_streaming, args=(text,))
gen_thread.start()
# Play audio as it arrives
self.play_streaming()
gen_thread.join()
# Create agent
agent = StreamingVoiceAgent(model, processor, voice_sample, device)
# Test streaming
print("Starting streaming generation...")
agent.speak("This is a real-time voice agent. Notice how the audio starts playing before the entire sentence is generated. This reduces latency for interactive applications.")
print("✓ Streaming complete")
Expected output:
Starting streaming generation...
✓ Streaming complete
You should hear the audio start playing within 1-2 seconds, even though the full sentence takes 5-6 seconds to generate. This is the difference between streaming (1-2s latency) and batch generation (5-6s latency).
Step 6: Integrate with a Chatbot for Full Voice Interaction
Combine Voxtral with a text generation model to create a complete voice assistant.
from transformers import AutoTokenizer, AutoModelForCausalLM
# Load a small language model for responses (using Mistral 7B Instruct)
llm_model_id = "mistralai/Mistral-7B-Instruct-v0.2"
tokenizer = AutoTokenizer.from_pretrained(llm_model_id)
llm = AutoModelForCausalLM.from_pretrained(
llm_model_id,
torch_dtype=torch.float16,
device_map="auto"
)
def voice_chatbot(user_text):
"""Generate text response, then speak it in your voice"""
# Generate text response
messages = [
{"role": "user", "content": user_text}
]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(device)
outputs = llm.generate(inputs, max_new_tokens=100, temperature=0.7)
response_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
# Extract just the assistant's response
response_text = response_text.split("[/INST]")[-1].strip()
print(f"Assistant: {response_text}")
# Speak the response in your voice
agent.speak(response_text)
return response_text
# Test the voice chatbot
print("User: What is machine learning?")
voice_chatbot("What is machine learning in one sentence?")
Expected output:
User: What is machine learning?
Assistant: Machine learning is a subset of artificial intelligence that enables computers to learn from data and improve their performance on tasks without being explicitly programmed.
The assistant's response will be spoken in your cloned voice. You now have a complete voice assistant that generates responses using Mistral 7B and speaks with your voice.
Expected Output
After completing all steps, you should have:
- Voice sample file:
my_voice_sample.wav(your 30-second recording) - Cloned speech files:
cloned_output.wav(English test)cloned_english.wav,cloned_french.wav,cloned_german.wav,cloned_spanish.wav,cloned_italian.wav(multilingual tests)
- Working voice agent: A
StreamingVoiceAgentclass that generates and plays speech in real-time - Voice chatbot: A
voice_chatbot()function combining text generation with voice synthesis
Quality check:
- Your cloned voice should sound recognizably like you (not perfect, but clearly your voice)
- Multilingual outputs should maintain your voice characteristics across languages
- Streaming playback should start within 1-2 seconds of calling
agent.speak() - The chatbot should respond with coherent answers spoken in your voice
If the voice quality is poor, the most common issue is background noise in your recording. Re-record in a quieter environment or use a better microphone.
Common Pitfalls
Pitfall: Model downloads fail with "Connection timeout": Large model downloads can time out on slower internet connections. The model is 8GB. If downloads fail, use huggingface-cli download mistralai/Voxtral-4B-TTS-2603 to download with automatic resume on failure. Or download manually from the model page and load with from_pretrained("/path/to/downloaded/model").
Pitfall: "CUDA out of memory" error on GPU: The model needs 8GB VRAM. If you have less, add device_map="auto" to from_pretrained() to split the model across CPU and GPU. Or run entirely on CPU by forcing device = "cpu" in Step 1—it works, just slower (10-15s per sentence instead of 2-3s).
Pitfall: Voice clone sounds robotic or distorted: Your voice sample has too much background noise or is too quiet. Re-record in a quiet room, speak clearly at normal volume, and keep the mic 6-12 inches from your mouth. Avoid recording on phone speakers—use headphones with a mic or a USB microphone. The model needs clean audio to learn your voice characteristics.
Pitfall: Generated audio is silent or corrupted: Check your voice sample with librosa.load('my_voice_sample.wav', sr=24000) and verify the array is not all zeros. If it is, your recording didn't save properly. Re-run Step 2 and make sure you see "Recording complete" before the script continues. Also verify ffmpeg is installed—Voxtral uses it for audio processing.
Pitfall: Multilingual output is in English regardless of input language: The model auto-detects language from the input text. If you're getting English output for French input, the text might have English characters or formatting that confuses detection. Make sure your text is pure French/German/etc with no English words mixed in. The processor handles language detection automatically based on the input text.
Quick Hits
Google TurboQuant: AI Memory Compression Breakthrough
Google Research unveiled TurboQuant, a compression algorithm that reduces AI model memory requirements by 6x with zero accuracy loss, achieving 8x speed improvements and 50%+ cost reductions. The breakthrough addresses the key-value cache bottleneck in LLMs and will be presented at ICLR 2026, with open-source release expected in Q2 2026. Following the announcement, memory chip stocks dropped nearly $100 billion in market value, with analysts citing investor concerns about potential reduced hardware demand, though multiple market factors were in play. Google Research Blog
Meta Hyperagents: Self-Improving AI Systems
Meta AI published a breakthrough paper introducing Hyperagents—AI systems that recursively modify their own code to improve both task performance and their improvement mechanisms. Unlike previous self-improving systems limited by human-engineered algorithms, Hyperagents use metacognitive self-modification to generalize across domains, which researchers suggest could represent progress toward more general AI capabilities, though the path to artificial general intelligence remains a subject of significant debate in the research community. The implementation code is publicly available on GitHub. ArXiv Paper
Cohere Transcribe: State-of-the-Art Speech Recognition
Cohere launched Transcribe, a 2-billion parameter ASR model that topped the Hugging Face Open ASR Leaderboard on launch day with the lowest average Word Error Rate. The model supports 14 languages, is open-sourced under Apache 2.0, and is specifically designed for enterprise speech intelligence applications like meeting transcription and customer call analysis. Cohere Blog | Hugging Face Model
Sources
- Mistral AI — Voxtral TTS
- Hugging Face — Voxtral-4B-TTS-2603 Model
- TechCrunch — Mistral releases a new open source model for speech generation
- Google Research Blog — TurboQuant: Redefining AI Efficiency with Extreme Compression
- ArXiv — Hyperagents: Self-Improving AI Systems
- GitHub — Meta Hyperagents Implementation
- Cohere Blog — Introducing Transcribe
- Hugging Face — Cohere Transcribe Model
