AudioFile

source extra: audio-file

Read an audio file and chunk it into smaller audio messages.

Node type:

AudioFile

Input:

–

Output:

AudioPayload

Extra:

audio-file

$ pip install "juturna-nodes[audio-file]"

How it works

The whole file is decoded on warmup with PyAV, resampled to mono at audio_rate, and converted to float32 samples in the [-1, 1] range. The last chunk is zero-padded to the full chunk length. When the file is over, the node stops producing messages.

The payload start and end are in seconds from the beginning of the file: with block_size: 2, the chunks cover 0.0–2.0, 2.0–4.0, and so on.

Every message carries the pipeline id in meta['session_id'].

Arguments

Argument

Type

Default

Description

file_source

str

""

Path of the audio file to read

block_size

int

3

Length of each produced chunk, in seconds

audio_rate

int

16000

Sampling rate the audio is resampled to, in Hz

License

  • Code: this node is part of juturna-nodes, MIT (its LICENSE file).

  • PyAV: BSD-3-Clause (the License-Expression of av on PyPI).

  • FFmpeg: effectively GPL. The PyAV wheels on PyPI bundle their own FFmpeg: av 19.0.2 ships FFmpeg 9.0.2 from the pyav-ffmpeg 9.0.2-4 build, which links x264 and x265 (GPL-2.0-or-later). The FFmpeg legal page says that when its GPL parts are used, “the GPL applies to all of FFmpeg”. The libraries still report “LGPL version 3 or later” only because a pyav-ffmpeg patch to FFmpeg’s configure moves x264 and x265 out of the libraries that need --enable-gpl. A PyAV built from source against an LGPL build of FFmpeg (without x264, x265 or other GPL parts) avoids the GPL. (Checked on 2026-11-18 on av 19.0.2.)

  • NumPy: BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0 (the License-Expression of numpy on PyPI).

Configuration

Default node arguments, as defined in the node config.toml file. Any of them can be overridden in the node configuration of a pipeline.

[arguments]
file_source = ""
block_size = 3
audio_rate = 16000

[meta]

Pipeline usage

{
  "name": "audio_file",
  "type": "AudioFile",
  "configuration": {}
}

Reference

class AudioFile(
file_source: str,
block_size: int,
audio_rate: int,
**kwargs,
)

Read in an audio file, chunk it based on the configured length, then make them available to the pipe in a real-time fashion.