A voice assistant that hears how you said it, then answers in a voice that means it.
Conversational AI with emotions · speech emotion recognition + emotion-controllable text-to-speech
Hear it · Where it stands · How a conversation runs · Steering the voice · Repository map · Run it
| 💗 Heartfelt · warm · tender · grateful | 😈 Mean · sarcastic · mocking · teasing |
|---|---|
heartfelt.mp4 |
mean.mp4 |
|
|
Two messages to the same friend, one a thank-you, one a roast, both spoken by the Zonos voice in tts/.
What changes between them is the words and the emotion conditioning. Press play and unmute 🔊 (files in docs/samples/).
Most voice assistants flatten everything into one cheerful tone. Empathize keeps the emotion in the loop on both ends: it listens for the emotion in your voice with a fine-tuned Wav2Vec2 classifier while faster-whisper transcribes the words, an LLM writes a reply together with an 8-number emotion vector, and Zonos speaks the reply with that emotion, pitch variation and pace.
Important
Each part runs on its own; the whole loop has not run on one machine yet. Whisper large and Zonos together need more than the 6 GB of VRAM the project was built on (CUDA ran out of memory), and long Zonos replies hit the same limit. On a bigger GPU the parts can be joined as drawn below.
| 🎭 7 | 🎯 100 % | 🎚️ 8-D | ⏱️ ≈ 3 min | 🧠 6 GB |
|---|---|---|---|---|
| emotions recognised from speech | held-out accuracy, 560 TESS clips | emotion vector steering the voice | to fine-tune the classifier (3 epochs) | VRAM: the limit that split the loop |
Works
- Emotion recognition from speech. Wav2Vec2-base fine-tuned on the Toronto Emotional Speech Set:
disgust, anger, sadness, happiness, surprise, fear, neutral. Every clip of the 20 % held-out split was
classified correctly (
train.ipynb). TESS is clean, acted speech from two speakers, so expect lower accuracy on a laptop microphone. - Live speech-to-text. faster-whisper (large, CUDA, fp16) with energy-based silence detection: speak,
pause, get the sentence (
speech_to_text/). - Emotional replies, spoken. Type a message; the LLM answers in strict JSON with text, 8 emotion weights
and 4 audio settings; Zonos speaks it (
tts/empathetic_ai.py). The samples above come from this voice.
Not done yet
- One script that runs microphone → transcription + emotion → LLM → voice end to end (needs a GPU with more than 6 GB).
- Feeding the detected emotion of the user into the LLM prompt.
- Testing the emotion classifier on speakers and microphones outside TESS.
| Demo | Project overview |
|---|---|
![]() |
![]() |
| Empathize answering with emotion | What it is and how the parts fit |
flowchart LR
MIC["🎙️ Microphone<br/>16 kHz mono"]
subgraph listen["Listen: in parallel"]
direction TB
STT["📝 faster-whisper large<br/>speech → words"]
SER["🎭 Wav2Vec2 classifier<br/>speech → emotion"]
end
LLM["🧠 LLM on Groq<br/>reply text<br/>+ 8 emotion weights<br/>+ pitch · rate · quality"]
TTS["🗣️ Zonos v0.1<br/>emotion-conditioned TTS"]
SPK["🔊 Speaker"]
MIC --> STT & SER
STT -. "words" .-> LLM
SER -. "how they were said" .-> LLM
KB["⌨️ Typed message<br/>(today)"] --> LLM
LLM --> TTS --> SPK
Solid arrows run today in tts/empathetic_ai.py. The dotted ones are the join that
needs the bigger GPU: speech_to_text/ and emotion_recognition/
each work on their own.
The LLM is told to answer only in JSON. Its reply carries the words, how much of each of Zonos's 8 emotions to put in them, and four audio settings. For "I got the job!":
{
"text": "That's wonderful news! Congratulations on this big achievement!",
"emotions": {
"happiness": 0.95, "sadness": 0.02, "disgust": 0.01, "fear": 0.02,
"surprise": 0.30, "anger": 0.01, "other": 0.05, "neutral": 0.10
},
"audio": { "vqscore": 0.78, "pitch_std": 55.0, "speaking_rate": 16.0, "dnsmos": 4.2 }
}EmotionTTS turns that into Zonos conditioning:
| Setting | Range | What it does | |
|---|---|---|---|
| 🎭 | emotions |
0–1 each | the 8-D emotion vector, in Zonos's order: happiness, sadness, disgust, fear, surprise, anger, other, neutral |
| 📈 | pitch_std |
20–45 calm · 60–150 expressive | pitch variation; more variation reads as more emotional |
| ⏩ | speaking_rate |
12–18 here | phonemes per second |
| ✨ | vqscore |
0.5–0.8 | target voice quality; high values pull towards neutral speech |
| 🔈 | dnsmos |
1–5, ≈ 4 | target clean-speech score; also favours neutral delivery |
| 🎯 | cfg_scale · min_p · seed |
2.0 · 0.15 · 420 | how strictly to follow the conditioning, sampling, reproducibility |
Why the emotion weights don't always land
The emotion vector is entangled with the rest of the conditioning (tts/CONDITIONING.md):
text that reads angry is easier to make sound angry than to make sound sad; a low pitch_std caps how
emotional any line can sound; and high vqscore / dnsmos nudge everything towards neutral. That is why
the LLM writes the audio settings alongside the emotions instead of leaving them fixed, and why the prompt
tells it not to slow sad replies down too far.
| Path | What |
|---|---|
emotion_recognition/ |
recognizer.py: the EmotionRecognizer class and a CLI · train.ipynb: fine-tuning on TESS · trained_model/: config and tokenizer files |
speech_to_text/ |
transcriber.py: live microphone transcription with silence detection · main.py: prints what you say |
tts/ |
empathetic_ai.py: the chat loop · emotion_tts.py: EmotionTTS · zonos/: Zyphra's model code (details) |
docs/ |
the two voice samples, as MP4s with sound |
requirements.txt |
everything outside Zonos: Groq, faster-whisper, librosa, the notebook's extras |
.env.example |
GROQ_API_KEY and an optional GROQ_MODEL |
You need Linux or macOS, Python 3.10+, uv, an NVIDIA GPU with 6 GB+ of VRAM (Zonos also runs on CPU, slowly), a free Groq API key, and two system libraries:
sudo apt install -y espeak-ng portaudio19-dev # macOS: brew install espeak-ng portaudioSet up once, everything in one environment inside tts/:
git clone https://github.com/JomGeorge66/empathize.git
cd empathize/tts
uv sync # Zonos + PyTorch into tts/.venv
uv pip install -e .
uv pip install -r ../requirements.txt # Groq, faster-whisper, librosa, …
cp ../.env.example ../.env # then paste your GROQ_API_KEY into itTalk to it (from tts/):
uv run python empathetic_ai.py # type a message, hear the reply; 'quit' to stop
uv run python emotion_tts.py # or just hear one sad line, no LLMThe listening side (from the repository root):
uv run --project tts python speech_to_text/main.py # speak, pause, see the words
uv run --project tts python emotion_recognition/recognizer.py clip.wav # predict the emotion of a clipNote
The classifier's weights (≈ 380 MB) are too big for git, so trained_model/ holds only its config.
Run emotion_recognition/train.ipynb from inside emotion_recognition/
once: it downloads TESS through kagglehub, fine-tunes for 3 epochs (about 3 minutes on a GPU) and saves
the weights into trained_model/.
Tip
Each Zonos reply is capped at 30 seconds of audio, and long replies are where 6 GB runs out. Any Groq chat
model can stand in for the default by setting GROQ_MODEL in .env.
| Zonos v0.1 by Zyphra | the emotion-conditioned voice; its code in tts/ is Apache 2.0 (licence) |
| Toronto Emotional Speech Set | 2,800 acted clips, 7 emotions, used to fine-tune the classifier |
| Wav2Vec2 by Meta AI | the speech encoder under the emotion classifier |
| faster-whisper by SYSTRAN | live transcription |
| Groq | fast LLM inference for the replies |
MIT (LICENSE), except the Zonos code in tts/, which is Zyphra's and stays under
Apache 2.0 (tts/LICENSE).

