AudioTree
AudioTree loads audio files, samples excerpts, and applies augmentations. An
AudioTree holds batched waveforms, a sample rate, and optional per-item data
such as loudness or labels. Use the NumPy transforms in CPU data loaders,
including PyTorch pipelines, or the JAX transforms inside jax.jit.
Install
Requires Python 3.12 or newer.
pip install audiotree
JAX, Flax, Grain, NumPy, librosa, and soundfile come with it.
On macOS and Linux, Bagz is also installed for
string leaves in TreeWriter/TreeDataSource and the windowed-LUFS cache.
audiotree[progress] (or audiotree[all]) adds tqdm for
AudioWriter(show_progress=True).
Quickstart
from audiotree import AudioTree
from audiotree.sources import create_audio_dataset
from audiotree.transforms import stereo, volume_norm
# A single file still has a batch axis.
audio = AudioTree.from_file("/data/audio/song.wav", sample_rate=44_100)
print(audio.waveform.shape) # (1, channels, samples)
# Sample five-second excerpts. num_epochs=None repeats indefinitely.
ds = create_audio_dataset(
sources=["/data/audio"],
sample_rate=44_100,
duration=5.0,
shuffle=True,
num_epochs=None,
)
# Grain derives a separate random stream for each random_map call.
ds = ds.seed(42)
ds = ds.map(stereo())
ds = ds.random_map(volume_norm(min_db=-20, max_db=-15))
# Concatenate along the existing batch axis.
it = iter(ds.to_iter_dataset().batch(8, batch_fn=AudioTree.batch))
batch: AudioTree = next(it)
print(batch.waveform.shape) # (8, 2, 220500), ordered by batch, channel, and sample
print(batch.sample_rate) # 44100 for the whole batch
print(batch.lufs.shape) # (8,), one measured LUFS value per item
print(batch.filepath[0]) # Source file for the first excerpt
Versioning
AudioTree uses Effort-based Versioning. See the changelog for changes that may require updates to your code.
Citation
@software{Braun_AudioTree_2026,
author = {Braun, David},
title = {{AudioTree}},
url = {https://github.com/DBraun/audiotree},
version = {1.1.0},
year = {2026}
}
See CITATION.cff.
License
MIT, with third-party notices for the julius-derived resampler and the
pyloudnorm-derived loudness code under
LICENSES/. The audio fixtures
under tests/assets/ in the repository are carved out of the MIT grant (the MUSDB18-HQ
excerpt is CC BY-NC-SA 4.0) and are not part of any published distribution.
Metadata
Release files for audiotree 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| audiotree-1.1.0.tar.gz | 179.7 kB | With provenance | Details for audiotree-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| audiotree-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for audiotree-1.1.0-py3-none-any.whl |
Total release size: 338.6 kB
Release files / audiotree-1.1.0.tar.gz
| Download URL | audiotree-1.1.0.tar.gz |
|---|---|
| Size | 179.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e8ea715842c6c63cc4b1699189ef703757832c7809390823b8814ece353d09da
|
|
BLAKE2b-256 checksum How to use checksums |
d3fcbfedf3927bedb740baaff4a32006bbcccc64a91aaa79a1e5e8880c75043f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logRelease files / audiotree-1.1.0-py3-none-any.whl
| Download URL | audiotree-1.1.0-py3-none-any.whl |
|---|---|
| Size | 158.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f3ba5489adb87951953cd0b029e829b39d140d8dc7f428ba0e7c6c211b017855
|
|
BLAKE2b-256 checksum How to use checksums |
85029b18439b14e5618305ea01aa55681b2891e57c5267001bf81e8fdc3f7ce1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logSecurity for audiotree 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for audiotree-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.