diff --git a/CHANGELOG.md b/CHANGELOG.md index 58a64ae90..8201001c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- `STTMuteFilter` now pushes the `STTMuteFrame` upstream and downstream, to + allow for more flexible `STTMuteFilter` placement. + - Play delayed messages from `ElevenLabsTTSService` if they still belong to the current context. diff --git a/examples/foundational/24-stt-mute-filter.py b/examples/foundational/24-stt-mute-filter.py index 2706bebaf..a39314e92 100644 --- a/examples/foundational/24-stt-mute-filter.py +++ b/examples/foundational/24-stt-mute-filter.py @@ -111,8 +111,8 @@ async def run_example(transport: BaseTransport, _: argparse.Namespace, handle_si pipeline = Pipeline( [ transport.input(), # Transport user input - stt_mute_processor, # Add the mute processor before STT stt, # STT + stt_mute_processor, # Add the mute processor between STT and context aggregator context_aggregator.user(), # User responses llm, # LLM tts, # TTS diff --git a/src/pipecat/processors/filters/stt_mute_filter.py b/src/pipecat/processors/filters/stt_mute_filter.py index 700313d31..5e77b60ee 100644 --- a/src/pipecat/processors/filters/stt_mute_filter.py +++ b/src/pipecat/processors/filters/stt_mute_filter.py @@ -133,7 +133,8 @@ class STTMuteFilter(FrameProcessor): if should_mute != self.is_muted: logger.debug(f"STTMuteFilter {'muting' if should_mute else 'unmuting'}") self._is_muted = should_mute - await self.push_frame(STTMuteFrame(mute=should_mute)) + await self.push_frame(STTMuteFrame(mute=should_mute), FrameDirection.UPSTREAM) + await self.push_frame(STTMuteFrame(mute=should_mute), FrameDirection.DOWNSTREAM) async def _should_mute(self) -> bool: """Determine if STT should be muted based on current state and strategies."""