Merge pull request #1721 from pipecat-ai/mb/simli-silent-frames

Fix: SimliVideoService was continuously emitting audio, preventing Bo…
This commit is contained in:
Mark Backman
2025-05-02 16:44:39 -04:00
committed by GitHub
3 changed files with 14 additions and 7 deletions

View File

@@ -64,13 +64,16 @@ class SimliVideoService(FrameProcessor):
async for audio_frame in self._simli_client.getAudioStreamIterator():
resampled_frames = self._pipecat_resampler.resample(audio_frame)
for resampled_frame in resampled_frames:
await self.push_frame(
TTSAudioRawFrame(
audio=resampled_frame.to_ndarray().tobytes(),
sample_rate=self._pipecat_resampler.rate,
num_channels=1,
),
)
audio_array = resampled_frame.to_ndarray()
# Only push frame is there is audio (e.g. not silence)
if audio_array.any():
await self.push_frame(
TTSAudioRawFrame(
audio=audio_array.tobytes(),
sample_rate=self._pipecat_resampler.rate,
num_channels=1,
),
)
async def _consume_and_process_video(self):
await self._pipecat_resampler_event.wait()