BaseAudioResampler

class pipecat.audio.resamplers.base_audio_resampler.BaseAudioResampler[source]

Bases: ABC

Abstract base class for audio resampling. This class defines an interface for audio resampling implementations.

abstractmethod async resample(audio, in_rate, out_rate)[source]

Resamples the given audio data to a different sample rate.

This is an abstract method that must be implemented in subclasses.

Parameters:
  • audio (bytes) – The audio data to be resampled, represented as a byte string.

  • in_rate (int) – The original sample rate of the audio data (in Hz).

  • out_rate (int) – The desired sample rate for the resampled audio data (in Hz).

Returns:

The resampled audio data as a byte string.

Return type:

bytes