Fix rnnoise filter to handle empty audio
This commit is contained in:
@@ -115,6 +115,10 @@ class RNNoiseFilter(BaseAudioFilter):
|
||||
if self._sample_rate != 48000 and self._resampler_in:
|
||||
in_audio = await self._resampler_in.resample(audio, self._sample_rate, 48000)
|
||||
|
||||
# If audio is empty, return empty bytes (no point in noise cancellation)
|
||||
if len(in_audio) == 0:
|
||||
return b""
|
||||
|
||||
# Convert bytes to numpy array (int16)
|
||||
audio_samples = np.frombuffer(in_audio, dtype=np.int16)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user