Skip to main content

Scenario

Enhance Mavera Speak sessions by assigning custom ElevenLabs voices to different personas. Each persona gets a unique voice, creating an immersive multi-voice audio experience. Flow: Mavera GET /personas → Match to ElevenLabs voices → POST /mave/chat (in-character) → ElevenLabs TTS per persona → Multi-voice audio

Code

Example Output

Error Handling

Pre-made IDs are stable but can change. Verify with GET /voices before starting. If a mapped voice is missing, fall back to the next in the pool.
Voices repeat via modulo if personas exceed the pool. Expand by fetching all voices from GET /voices and selecting based on gender/accent metadata.
Concatenate with ffmpeg: ffmpeg -i "concat:track1.mp3|silence.mp3|track2.mp3" -c copy session.mp3. Generate gaps: ffmpeg -f lavfi -i anullsrc=r=44100:cl=mono -t 1 silence.mp3.