load_audio#

Defined in: voxatlas.audio.loader

voxatlas.audio.loader.load_audio(path, channel_mode='auto')[source]#

Load an audio/video file into one or more Audio objects.

Supported inputs are .wav and .mp4 files. Multi-channel inputs can be kept as separate channels or mixed down to mono based on channel_mode.

Parameters:
  • path (str) – Path to a .wav audio file or .mp4 video file with an audio track.

  • channel_mode (str) –

    Channel handling strategy:

    • "auto": return mono as one item; stereo as two channel-split items; reject inputs with more than 2 channels.

    • "mono": average all channels into a single mono waveform.

    • "split": return one Audio object per input channel.

Returns:

Loaded audio streams as Audio objects with float32 waveforms.

Return type:

list[Audio]

Examples

>>> from voxatlas.audio.loader import load_audio
>>> # Let the loader infer channel behavior (mono -> 1, stereo -> 2).
>>> streams = load_audio("samples/example.wav")
>>> # Force mono downmix.
>>> mono = load_audio("samples/example.wav", channel_mode="mono")