I feel like the agents audio is of lower quality ....
# ask-ai
m
I feel like the agents audio is of lower quality . I have elevenlabs for tts. Is there a way to configure the output format for better bitrate
t
Thanks for reaching out, AI. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I hear you: you’re hearing lower-quality agent audio and want to know whether you can change the ElevenLabs TTS output format (to effectively get a higher bitrate / clearer audio). I’ll walk through what you can change and give recommended settings. Short answer • You can’t set a “bitrate” directly, but you can improve perceived quality by changing the TTS output encoding (sample rate/format) and a few other parameters in the ElevenLabs plugin. Higher sample rates like
pcm_22050
or
pcm_44100
produce clearer audio, though they use more bandwidth. What to change (key settings) • encoding (audio format / sample rate) — choose a higher PCM sample rate such as
pcm_22050
or
pcm_44100
. This yields richer, clearer audio than lower rates. • model — use a higher-fidelity model (for example
eleven_multilingual_v2
or other higher-fidelity ElevenLabs models) to improve clarity. • voice_id / voice — pick a higher-quality voice if available; voices differ in fidelity. • chunk_length_schedule — adjust chunking to reduce streaming artifacts (helps smoothness during long or streaming responses). • use_tts_aligned_transcript — enable word-level alignment to avoid timing issues that can create stutters or perceived quality drops. Code examples • Python (example):
Copy code
from livekit.plugins import elevenlabs

tts = elevenlabs.TTS(
    model="eleven_multilingual_v2",
    voice_id="your_voice_id",
    encoding="pcm_22050",     # try pcm_22050 or pcm_44100
    chunk_length_schedule=[80, 120, 200]
)
session = AgentSession(tts=tts, use_tts_aligned_transcript=True)
• Node.js (example):
Copy code
import * as elevenlabs from '@livekit/agents-plugin-elevenlabs';

const tts = new elevenlabs.TTS({
    model: "eleven_multilingual_v2",
    voice: { id: "your_voice_id" },
    encoding: "pcm_22050"
});

const session = new voice.AgentSession({
    tts,
    voiceOptions: { useTtsAlignedTranscript: true }
});
Practical tips to get the best end-to-end quality • Match sample rates where possible (avoid unnecessary resampling). If your TTS outputs 44.1kHz audio but your pipeline resamples to a lower rate, you’ll lose quality. • Remember LiveKit will ultimately wrap audio into WebRTC (Opus). Starting with higher-quality PCM improves the Opus input and the final perceived audio. • If you see stutter/interruptions, try tuning
chunk_length_schedule
or set
preemptive_generation=False
to avoid clipping mid-sentence. • If you need normalization or extra post-processing (EQ, de-essing), you can override the
tts_node
to apply that processing before sending audio into the pipeline. Would you like help with any of the following? • I can provide a copy/paste-ready example matching your project language (Node or Python) and where to place this in your agent code. • If you tell me which
encoding
and model you’re currently using and whether you’re seeing stutter vs just muffled/low fidelity, I can give a targeted setting suggestion. If you want, tell me: which language (Node/Python) and current encoding/model you’re using and a brief description of the quality issue (muffled, robotic, stuttering, low volume). I’ll propose a concrete config to try. Sources: ElevenLabs TTS plugin guide | LiveKit Documentation | Pipeline nodes and hooks | LiveKit Documentation
m
"mp3_22050_32", "mp3_44100", "mp3_44100_32", "mp3_44100_64", "mp3_44100_96", "mp3_44100_128", "mp3_44100_192", These are the available one
t
Thanks — that list is helpful. You’ve shown the available MP3 encodings: different sample-rate and bitrate combos. I’ll explain how those affect perceived quality and give a practical recommendation you can try. Quick summary of the listed options • mp3_22050_32 — 22.05 kHz sample rate, 32 kbps bitrate (lower fidelity). • mp3_44100 — 44.1 kHz sample rate, unspecified bitrate (best treated as baseline 128 kbps in many systems, but here you also have explicit bitrate options). • mp3_44100_32 / 64 / 96 / 128 / 192 — 44.1 kHz sample rate with explicit bitrates (32–192 kbps). What this means for quality • Sample rate: 44.1 kHz (mp3_44100 variants) preserves more high-frequency content than 22.05 kHz (mp3_22050_32). Use 44.1 kHz for clearer, more natural voice. • Bitrate: higher bitrate reduces compression artifacts and improves clarity and warmth. 128 kbps or 192 kbps will sound noticeably better than 32–64 kbps for voice. • Tradeoffs: higher sample rates and bitrates increase payload size and bandwidth. If bandwidth is constrained, choose a middle ground (e.g., 96–128 kbps at 44.1 kHz). Practical recommendation • Try one of the 44.1 kHz options with a higher bitrate first — mp3_44100_128 or mp3_44100_192. These will give the clearest, most natural-sounding output. • If you need to save bandwidth, test mp3_44100_96 as a compromise. Avoid mp3_22050_32 unless you must minimize size. How to apply this in your ElevenLabs TTS plugin • Set the encoding to one of those mp3 values when creating the TTS instance (the plugin accepts those encodings). Example (conceptual): ◦ encoding: "mp3_44100_128" — for high quality ◦ encoding: "mp3_44100_96" — for balanced quality/size Additional tips • Match downstream settings: if your LiveKit pipeline or player resamples audio, try to avoid unnecessary resampling; keeping 44.1 kHz end-to-end avoids quality loss. • If you still hear artifacts after increasing to mp3_44100_128/192, check for network packet loss, aggressive transcoding in the path, or any additional processing (volume normalization, resampling) that may be degrading audio. • If latency or bandwidth is an issue, test mp3_44100_96 to see if it meets quality needs with lower bandwidth. If you want, tell me: • which option you’ll try first (128 or 192), and whether you’re running in Node or Python — I’ll give the exact code snippet to set that encoding in your agent’s TTS configuration.