diff --git a/CHANGELOG.md b/CHANGELOG.md index c35a6944e..24a422966 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed an issue in `SarvamTTSService` where the last sentence was not being + spoken. Now, audio is flushed when the TTS services receives the + `LLMFullResponseEndFrame` or `EndFrame`. + - Fixed an issue in `AWSTranscribeSTTService` where the `region` arg was always set to `us-east-1` when providing an AWS_REGION env var. diff --git a/src/pipecat/services/sarvam/tts.py b/src/pipecat/services/sarvam/tts.py index 197eb1548..b60a505eb 100644 --- a/src/pipecat/services/sarvam/tts.py +++ b/src/pipecat/services/sarvam/tts.py @@ -514,9 +514,11 @@ class SarvamTTSService(InterruptibleTTSService): async def process_frame(self, frame: Frame, direction: FrameDirection): """Process a frame and flush audio if it's the end of a full response.""" - if isinstance(frame, LLMFullResponseEndFrame): + await super().process_frame(frame, direction) + + # When the LLM finishes responding, flush any remaining text in Sarvam's buffer + if isinstance(frame, (LLMFullResponseEndFrame, EndFrame)): await self.flush_audio() - return await super().process_frame(frame, direction) async def _update_settings(self, settings: Mapping[str, Any]): """Update service settings and reconnect if voice changed."""