Audio Recording
Record and buffer audio from conversations
The AudioBufferProcessor
allows you to record and buffer audio from both input (user) and output (bot) sources during conversations. It supports both mono and stereo recording with configurable sample rates.
Usage
To record audio, create an instance of AudioBufferProcessor
and add it to your pipeline:
Recording Controls
Start Recording
Begin recording audio from the conversation:
Stop Recording
Stop the current recording session:
Audio Event Handling
You can handle recorded audio by registering an event handler for the on_audio_data
event:
Configuration Options
The desired output sample rate in Hz. If not specified, uses the transport’s sample rate.
Number of audio channels: - 1
: Mono (mixed user and bot audio) - 2
: Stereo
(user audio in left channel, bot audio in right channel)
Size in bytes that triggers the on_audio_data
event: - 0
: Only triggers
when recording stops - >0
: Triggers whenever buffer reaches this size
Properties
The current sample rate being used for recording
The number of channels being recorded (1 or 2)