base_audio_resampler

Base audio resampler interface for Pipecat.

This module defines the abstract base class for audio resampling implementations, providing a common interface for converting audio between different sample rates.

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

Bases: ABC

Abstract base class for audio resampling implementations.

This class defines the interface that all audio resampling implementations must follow, providing a standardized way to convert audio data between different sample rates.

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

Resamples the given audio data to a different sample rate.

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

Parameters:
  • audio – The audio data to be resampled, as raw bytes.

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

  • out_rate – The desired sample rate for the output audio in Hz.

Returns:

The resampled audio data as raw bytes.