Docs /Templates/ sinapsis-data-readers

LazyAudioReaderPydub

sinapsis-data-readerscommunityaudioreaderspydubsoundfile

Python template · sinapsis_data_readers.templates.audio_readers.audio_reader_pydub

Overview

Reads an audio file using Pydub, obtaining the file path from the generic_field of the DataContainer and setting is as the file_path in the attributes.

Capabilities

Capabilities: not set

Installation

Install the published package using pip or uv.

Terminalbash
pip install sinapsis-data-readers==1.0.0
uv pip install sinapsis-data-readers==1.0.0
uv add sinapsis-data-readers==1.0.0

Configuration

Effective fields from the inspector schema, including nested Pydantic model fields.

source
str
Optional
Default: "f8beca0a-1ed4-4fd3-a751-cbbda0405dca"
metadata
sinapsis_core.template_base.base_models.TemplateMetadata | None
Optional
Default: null
root_dir
str | None
Optional
Default: null
from_bytes

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.

bool
Optional
Default: false
generic_keyRequired
str
Required
Default: null
audio_file_path
str | None
Optional
Default: null
sample_rate_khz

Sample rate in khz for the processed audio. Defaults to 16hkz.

int
Optional
Default: 16
audio_reader_format
typing.Optional[typing.Literal['wav', 'raw', 'pcm']]
Optional
Default: null

Configuration example

Example from the Python docstring:

yaml
agent:
      name: my_test_agent
    templates:
    - template_name: InputTemplate
      class_name: InputTemplate
      attributes: {}
    - template_name: LazyAudioReaderPydub
      class_name: LazyAudioReaderPydub
      template_input: InputTemplate
      attributes:
        sample_rate_khz: 16
        from_bytes: False
Show schema-based configuration skeleton
yaml
templates:
  - template_name: "LazyAudioReaderPydub"
    class_name: "LazyAudioReaderPydub"
    attributes:
      source: "f8beca0a-1ed4-4fd3-a751-cbbda0405dca"
      root_dir: null
      from_bytes: false
      generic_key: "<required>"
      audio_file_path: null
      sample_rate_khz: 16
      audio_reader_format: null

Inheritance

Immediate parent: sinapsis_data_readers.templates.audio_readers.audio_reader_pydub.AudioReaderPydub

Environment variables

Environment definitions belong to their canonical Python modules.

No directly related environment variables listed.