can i generate transcripts from my voice pipeline?
# ask-ai
c
can i generate transcripts from my voice pipeline?
t
Thanks for reaching out, raj. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Absolutely, you can generate transcripts from a voice pipeline in LiveKit! The LiveKit Agents framework makes it easy to get real-time transcriptions of both user and agent speech. This happens through the
VoicePipelineAgent
or
MultimodalAgent
classes, which can send transcriptions right to your frontend app if you set it up that way. Transcriptions come in segments, each linked to a participant and track, and they’re marked as final once complete. You can also keep track of these transcriptions on the server side by listening to events like
user_speech_committed
and
agent_stopped_speaking
. Here’s how you can tweak the transcription settings: • Turn synchronized transcription forwarding on or off using
RoomOutputOptions
. • Use TTS-aligned transcription for better timing and accuracy. • Customize how transcriptions appear with the
transcription_node()
hook. If you’re working with custom agents, the
STTSegmentsForwarder
class lets you forward transcriptions manually. Just give me a shout if you want more details or need a hand getting it all set up! Sources: Example Applications | livekit/livekit_composite | DeepWiki | Transcriptions | LiveKit Docs | Recording agent sessions | LiveKit Docs | livekit-agents/livekit/agents/voice/transcription/synchronizer.py | Docs::Agents
c
how to debug each portion of the voice pipeline. STT LLM and TTS
t
Hey there! You can debug each part of the voice pipeline (STT, LLM, TTS) by overriding specific pipeline nodes in your custom
Agent
subclass. Here’s a friendly guide on how to tackle debugging for each component: 1. Debugging STT (Speech-to-Text) • Try overriding the
stt_node()
method to peek at or tweak the audio input and transcription output. • It’s super helpful to log audio frames and transcription events before and after processing. • Here’s an example:
Copy code
async def stt_node(self, audio: AsyncIterable[rtc.AudioFrame], model_settings: ModelSettings):
    print("STT: Processing audio frames...")
    events = await Agent.default.stt_node(self, audio, model_settings)
    async for event in events:
        print(f"STT Output: {event}")
        yield event
2. Debugging LLM (Language Model) • Override the
llm_node()
method to check out the chat context and the responses generated by the LLM. • Logging input messages and output chunks can really help you understand what’s happening under the hood. • Here’s how you might do it:
Copy code
async def llm_node(self, chat_ctx: llm.ChatContext, model_settings: ModelSettings):
    print(f"LLM Input: {chat_ctx.messages}")
    response = await Agent.default.llm_node(self, chat_ctx, model_settings)
    async for chunk in response:
        print(f"LLM Output: {chunk}")
        yield chunk
3. Debugging TTS (Text-to-Speech) • Give overriding the
tts_node()
method a shot to keep an eye on text input and audio output. • Logging text segments before synthesis and trying out custom audio processing can be really insightful. • Check out this example:
Copy code
async def tts_node(self, text: AsyncIterable[str], model_settings: ModelSettings):
    async for segment in text:
        print(f"TTS Input Text: {segment}")
        yield segment
Extra Debugging Tips • Use lifecycle hooks like
on_user_turn_completed()
to get a better look at user input and chat context. • Catch errors with
session.on("error")
to log any hiccups in STT, LLM, or TTS. • Don’t forget about metrics tracking—it’s great for profiling latency and accuracy. If you want, I’m here to help with implementation or any specific debugging scenarios you run into. Just let me know! Sources: Pipeline nodes and hooks | LiveKit Docs | Docs::Agents | examples/voice_agents/error_callback.py | examples/src/comprehensive_test.ts | Pipeline nodes and hooks | LiveKit Docs
c
eleven labs tts plugin configuration
t
Hey there! Just to make sure I’m on the right track, are you looking for guidance on how to integrate Eleven Labs TTS with a particular LiveKit agent, or do you need some general tips on setting up Eleven Labs TTS? Also, it would be super helpful to know if you’re working with any specific programming language or framework. Let me know so I can help you better!
c
# 🎯 ElevenLabs TTS Issue Summary ## The Core Problem ElevenLabs TTS is NOT the issue - it works perfectly when called directly. The problem is with LiveKit's integration of ElevenLabs TTS within the agent pipeline. ## Evidence ### ✅ ElevenLabs TTS Works - Direct API Call: Generated 54,797 bytes of audio successfully - API Key: Valid and working (
sk_408bf95...
) - Voice ID:
21m00Tcm4TlvDq8ikWAM
(Rachel voice) is valid - Model:
eleven_monolingual_v1
is working ### ❌ LiveKit Plugin Fails - Outside Job Context:
RuntimeError: Attempted to use an http session outside of a job context
- Inside Job Context: Plugin works but generates silent audio - Error Pattern:
APIConnectionError: Connection error. (body=None, retryable=True)
## Root Cause Analysis ### The Real Issue 1. ElevenLabs TTS Plugin: Requires proper HTTP session management within LiveKit job context 2. Session Management: LiveKit's HTTP context is not properly initialized for the ElevenLabs plugin 3. Silent Audio Generation: Plugin fails silently and generates empty audio frames instead of speech ### Technical Details
Copy code
python
# This works - Direct API call
response = requests.post(url, json=data, headers=headers)  # :white_check_mark: 54,797 bytes

# This fails - LiveKit plugin
tts = elevenlabs.TTS(api_key=api_key, voice_id="21m00Tcm4TlvDq8ikWAM")
# :x: RuntimeError: Attempted to use an http session outside of a job context
## Impact - KAORI Agent: Generates 501 audio frames but all are silent (RMS: 0.000004) - User Experience: No speech output despite successful connection and audio streaming - File Generation: Creates correct-sized WAV files (481,004 bytes) but with no sound ## Solution Attempted Switched to OpenAI TTS but same issue persists: - OpenAI TTS: Also generates silent audio in LiveKit context - Same Pattern: 501 frames, 481,004 bytes, but silent content - Conclusion: Issue is with LiveKit agent pipeline, not TTS provider ## Final Diagnosis The issue is NOT with ElevenLabs TTS - it's with LiveKit's agent pipeline configuration that prevents any TTS provider from generating actual speech content. The agent generates audio frames but they contain silence instead of synthesized speech. ElevenLabs TTS works perfectly when called directly, but fails within the LiveKit agent context due to HTTP session management issues.
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!