Microphone Management
Start/Stop Microphone
Programmatically connect or disconnect the microphone track:Muting and Unmuting
Mute or unmute microphone input without tearing down the audio track:Get Microphone State
get_input_audio_state() returns an InputAudioState object containing both the mute status and mic permission status:
TruGenRunner shortcut
If you’re usingTruGenRunner, toggle mute from the main thread safely:
Audio Injection
You can stream custom audio into the room — a pre-recorded WAV file or raw 16-bit PCM bytes. Useful for scripted playback, voice cloning demos, or piping in audio from another source.Upload a WAV file
Stream a PCM WAV file into the room:Send raw PCM bytes
Inject raw 16-bit PCM bytes directly:send_audio() when your source is already decoded — TTS output from another provider, live audio from a different track, or synthetic audio you’re generating on the fly.
Safe injection pattern
The recommended pattern (used inexamples/advanced_session_ui.py) mutes the mic during injection and restores its previous state afterwards:
Next steps
Event Handling
Listen to connection, speaking, and transcription events.
Advanced Example
Full GUI viewer with WAV injection, captions, and speaking state.