Input
AudioInput
dataclass
Static audio to be used as input for the VoicePipeline.
Source code in src/agents/voice/input.py
buffer
instance-attribute
A buffer containing the audio data for the agent. Must be a numpy array of int16 or float32.
frame_rate
class-attribute
instance-attribute
The sample rate of the audio data. Defaults to 24000.
sample_width
class-attribute
instance-attribute
The sample width of the audio data. Defaults to 2.
channels
class-attribute
instance-attribute
The number of channels in the audio data. Defaults to 1.
to_audio_file
Returns a tuple of (filename, bytes, content_type)
to_base64
Returns the audio data as a base64 encoded string.
Source code in src/agents/voice/input.py
StreamedAudioInput
Audio input represented as a stream of audio data. You can pass this to the VoicePipeline
and then push audio data into the queue using the add_audio
method.
Source code in src/agents/voice/input.py
add_audio
async
Adds more audio data to the stream.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
audio
|
NDArray[int16 | float32]
|
The audio data to add. Must be a numpy array of int16 or float32. |
required |