audiomentations
A Python library for audio data augmentation. Inspired by albumentations. Useful for machine learning.
What it is and what it does
Audiomentations is a Python library for augmenting audio data by applying randomized transformations to waveforms. It provides a Compose-based API inspired by albumentations, letting you chain transforms like noise injection, pitch shifting, time stretching, filtering, and distortion with configurable probability. The library runs on CPU, supports both mono and multichannel audio, and integrates directly into training loops for TensorFlow/Keras and PyTorch.
The package solves the problem of generating synthetic audio variations during training to improve model robustness and generalization. Rather than manually coding audio effects, you declare a pipeline of transforms with parameter ranges, and the library applies them randomly to each sample during training. It is designed for practitioners building real-world audio ML systems—speech recognition, audio classification, sound event detection—where models trained only on clean lab data often fail in production.
Use it for:
- Augment speech data during training to improve robustness to background noise and acoustic variation.
- Generate synthetic pitch and tempo variations to train music information retrieval models.
- Simulate room acoustics and microphone artifacts to make audio classifiers generalize across recording conditions.
- Add realistic distortion and compression artifacts to train models that handle low-quality or compressed audio.
- Combine multiple transforms in a pipeline to create diverse training samples from a small audio dataset.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Audiomentations applies randomized audio transformations—noise injection, pitch shifting, time stretching, filtering, and distortion—to augment training data for machine learning models that work with audio.
Yes. Audiomentations is actively maintained, has no security vulnerabilities, installs with low friction, and provides a well-documented, production-ready API for audio augmentation. It is particularly valuable if you are training audio ML models and need to generate synthetic variations without writing custom signal processing code. The MIT license removes legal barriers. Install it if audio data augmentation is part of your training pipeline.
Install
audiomentations on PyPI
pip
pip install audiomentationsuv
uv add audiomentationspoetry
poetry add audiomentationsInstalling audiomentations
Before you install
Low friction: pure Python wheel with no compiled dependencies beyond numpy and scipy. Actively maintained with a recent release (335 days ago) and 2310 repository stars. Supports Python 3.10–3.13.
License in practice
MIT license permits unrestricted commercial and private use, modification, and distribution with minimal legal friction.
Quickstart
pip install audiomentations
from audiomentations import Compose, AddGaussianNoise, TimeStretch, PitchShift
import numpy as np
augment = Compose([
AddGaussianNoise(min_amplitude=0.001, max_amplitude=0.015, p=0.5),
TimeStretch(min_rate=0.8, max_rate=1.25, p=0.5),
PitchShift(min_semitones=-4, max_semitones=4, p=0.5),
])
samples = np.random.uniform(low=-0.2, high=0.2, size=(32000,)).astype(np.float32)
augmented = augment(samples=samples, sample_rate=16000)
Verify before relying
- Whether all 7 runtime dependencies (numpy-minmax, numpy-rms, python-stretch, soxr) are required for core functionality or only for specific transforms.
- Performance characteristics and typical augmentation speed on CPU for real-time training pipelines.
- Multichannel audio support details and any channel-count constraints.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 7 — numpy, numpy-minmax, numpy-rms, librosa, python-stretch, scipy, soxr |
| Maintenance | actively maintained — 335 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 211,335/month — #9,481 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: audiomentations-0.43.1-py3-none-any.whl
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
nlpaugnlpaug generates synthetic augmented text and…
permissive · top 15,000 on PyPI
pedalboardpedalboard reads, writes, and processes audio…
copyleft · top 5,000 on PyPI
torch-audiomentationsProvides PyTorch-native audio data augmentation…
permissive · top 5,000 on PyPI
descript-audiotoolsProvides object-oriented audio signal handling…
permissive · top 15,000 on PyPI
noisereduceReduces noise in audio and time-domain signals…
permissive · top 15,000 on PyPI
python-stretchPitch-shifts and time-stretches audio using the…
permissive · top 15,000 on PyPI
stftpitchshiftShifts the pitch and timbre of audio signals…
permissive · top 15,000 on PyPI
soxPython wrapper that exposes SoX audio…
permissive · top 5,000 on PyPI
albumentationsAlbumentations applies image transformations to…
permissive · top 5,000 on PyPI
imgaugAugments images and related data (heatmaps,…
permissive · top 5,000 on PyPI