BaseAudioFilter

class pipecat.audio.filters.base_audio_filter.BaseAudioFilter[source]

Bases: ABC

This is a base class for input transport audio filters. If an audio filter is provided to the input transport it will be used to process audio before VAD and before pushing it downstream. There are control frames to update filter settings or to enable or disable the filter at runtime.

abstractmethod async start(sample_rate)[source]

This will be called from the input transport when the transport is started. It can be used to initialize the filter. The input transport sample rate is provided so the filter can adjust to that sample rate.

Parameters:

sample_rate (int)

abstractmethod async stop()[source]

This will be called from the input transport when the transport is stopping.

abstractmethod async process_frame(frame)[source]

This will be called when the input transport receives a FilterControlFrame.

Parameters:

frame (FilterControlFrame)

abstractmethod async filter(audio)[source]
Parameters:

audio (bytes)

Return type:

bytes