diff --git a/voicebot/main.py b/voicebot/main.py index 124aa65..3347088 100644 --- a/voicebot/main.py +++ b/voicebot/main.py @@ -391,12 +391,12 @@ class SilentAudioTrack(MediaStreamTrack): """Generate silent audio frames""" pts, time_base = await self.next_timestamp() - # Create silent audio data - samples = np.zeros((self.samples_per_frame,), dtype=np.float32) + # Create silent audio data in s16 format (required by Opus encoder) + samples = np.zeros((self.samples_per_frame,), dtype=np.int16) # Convert to AudioFrame frame = AudioFrame.from_ndarray( - samples.reshape(1, -1), format="flt", layout="mono" + samples.reshape(1, -1), format="s16", layout="mono" ) frame.sample_rate = self.sample_rate frame.pts = pts