AudioReaderPydub
Python template · sinapsis_data_readers.templates.audio_readers.audio_reader_pydub
Overview
Audio reader for reading audio data directly from bytes or files using Pydub.
This class can read audio data from either a bytes object or a file path, using the Pydub library. When reading from bytes, it retains the data in byte format. When reading from a file, it converts the audio data to a NumPy array.
Capabilities
Capabilities: not setInstallation
Install the published package using pip or uv.
pip install sinapsis-data-readers==1.0.0uv pip install sinapsis-data-readers==1.0.0uv add sinapsis-data-readers==1.0.0Configuration
Effective fields from the inspector schema, including nested Pydantic model fields.
Optional
Default: "f8beca0a-1ed4-4fd3-a751-cbbda0405dca"
Optional
Default: null
Optional
Default: null
Flag to determine if the file is in bytes. Defaults to True. audio_reader_format (Literal["wav", "raw", "pcm"] | None) Format of the source audio file, if not provided will be automatically detected. Defaults to None.
Optional
Default: false
Required
Default: null
Sample rate in khz for the processed audio. Defaults to 16hkz.
Optional
Default: 16
Optional
Default: null
Configuration example
Example from the Python docstring:
agent:
name: my_test_agent
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: AudioReaderPydub
class_name: AudioReaderPydub
template_input: InputTemplate
attributes:
audio_file_path: '/path/to/file.mp3'
source: 'source/of/file'
sample_rate_khz: 16
from_bytes: falseShow schema-based configuration skeleton
templates:
- template_name: "AudioReaderPydub"
class_name: "AudioReaderPydub"
attributes:
source: "f8beca0a-1ed4-4fd3-a751-cbbda0405dca"
root_dir: null
from_bytes: false
audio_file_path: "<required>"
sample_rate_khz: 16
audio_reader_format: null
Inheritance
sinapsis_data_readers.templates.audio_readers.base_audio_reader._AudioBaseReaderEnvironment variables
Environment definitions belong to their canonical Python modules.
No directly related environment variables listed.