SoxrResampler

class pipecat.audio.resamplers.soxr_resampler.SOXRAudioResampler(**kwargs)[source]

Bases: BaseAudioResampler

Audio resampler implementation using the SoX resampler library.

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