Overview
STTMuteFilter is a general-purpose processor that combines STT muting and interruption control. When active, it prevents both transcription and interruptions during specified conditions (e.g., bot speech, function calls), providing a cleaner conversation flow.
The processor supports multiple simultaneous strategies for when to mute the STT service, making it flexible for different use cases.
Constructor Parameters
STTMuteConfig
required
Configuration object that defines the muting strategies and optional custom
logic
Optional[STTService]
required
The STT service to control (deprecated, will be removed in a future version)
Configuration
The processor is configured usingSTTMuteConfig, which determines when and how the STT service should be muted:
set[STTMuteStrategy]
Set of muting strategies to apply
Callable[[STTMuteFilter], Awaitable[bool]]
default:"None"
Optional callback for custom muting logic (required when strategy is
CUSTOM)Muting Strategies
STTMuteConfig accepts a set of these STTMuteStrategy values:
STTMuteStrategy
Mute only during the bot’s first speech (typically during introduction)
STTMuteStrategy
Start muted and remain muted until first bot speech completes. Useful when bot
speaks first and you want to ensure its first response cannot be interrupted.
STTMuteStrategy
Mute during LLM function calls (e.g., API requests, external service calls)
STTMuteStrategy
Mute during all bot speech
STTMuteStrategy
Use custom logic provided via callback to determine when to mute. The callback
is invoked when the bot is speaking and can use application state to decide
whether to mute. When the bot stops speaking, unmuting occurs automatically if
no other strategy requires muting.
MUTE_UNTIL_FIRST_BOT_COMPLETE and FIRST_SPEECH strategies should not be
used together as they handle the first bot speech differently.Input Frames
Frame
Indicates bot has started speaking
Frame
Indicates bot has stopped speaking
Frame
Indicates a function call has started
Frame
Indicates a function call has completed
Frame
Indicates an interim transcription result (suppressed when muted)
Frame
User interruption start event (suppressed when muted)
Frame
User interruption stop event (suppressed when muted)
Frame
Indicates a transcription result (suppressed when muted)
Frame
Indicates user has started speaking (suppressed when muted)
Frame
Indicates user has stopped speaking (suppressed when muted)
Output Frames
Frame
Control frame to mute/unmute the STT service
Usage Examples
Basic Usage (Mute During Bot’s First Speech)
Mute Until First Bot Response Completes
Always Mute During Bot Speech
Custom Muting Logic
TheCUSTOM strategy allows you to control muting based on application state when the bot is speaking. The callback will be invoked whenever the bot is speaking, and your logic decides whether to mute:
Combining Multiple Strategies
Frame Flow
Notes
- Combines STT muting and interruption control into a single concept
- Muting prevents both transcription and interruptions
- Multiple strategies can be active simultaneously
- CUSTOM strategy callback is only invoked when the bot is speaking
- Unmuting happens automatically when bot speech ends (if no other strategy requires muting)
- Placed between the STT service and context aggregator in pipeline
- Maintains conversation flow during bot speech and function calls
- Efficient state tracking for minimal overhead