BaseAudioMixer
- class pipecat.audio.mixers.base_audio_mixer.BaseAudioMixer[source]
Bases:
ABC
This is a base class for output transport audio mixers. If an audio mixer is provided to the output transport it will be used to mix the audio frames coming into to the transport with the audio generated from the mixer. There are control frames to update mixer settings or to enable or disable the mixer at runtime.
- abstractmethod async start(sample_rate)[source]
This will be called from the output transport when the transport is started. It can be used to initialize the mixer. The output transport sample rate is provided so the mixer can adjust to that sample rate.
- Parameters:
sample_rate (int)
- abstractmethod async stop()[source]
This will be called from the output transport when the transport is stopping.
- abstractmethod async process_frame(frame)[source]
This will be called when the output transport receives a MixerControlFrame.
- Parameters:
frame (MixerControlFrame)
- abstractmethod async mix(audio)[source]
This is called with the audio that is about to be sent from the output transport and that should be mixed with the mixer audio if the mixer is enabled.
- Parameters:
audio (bytes)
- Return type:
bytes