Back to rankings

iver56/audiomentations

Pythoniver56.github.io/audiomentations/

A Python library for audio data augmentation. Useful for making audio ML models work well in the real world, not just in the lab.

audiosounddata-augmentationaugmentationsound-processingpythonmachine-learningmusicdeep-learningaudio-effectsaudio-data-augmentationdsp
Star Growth
Stars
2.3k
Forks
221
Weekly Growth
Issues
51
1k2k
Feb 2019Jul 2021Jan 2024Jul 2026
ArtifactsPyPIpip install audiomentations
README

Audiomentations

Build status Code coverage Code Style: Black Licence: MIT DOI

Audiomentations is a Python library for audio data augmentation, built to be fast and easy to use - its API is inspired by albumentations. It's useful for making audio deep learning models work well in the real world, not just in the lab. Audiomentations runs on CPU, supports mono audio and multichannel audio and integrates well in training pipelines, such as those built with TensorFlow/Keras or PyTorch. It has helped users achieve world-class results in Kaggle competitions and is trusted by companies building next-generation audio products with AI.

Need a Pytorch-specific alternative with GPU support? Check out torch-audiomentations!

Setup

Python version support PyPI version Number of downloads from PyPI per month os: Linux, macOS, Windows

pip install audiomentations

Usage example

from audiomentations import Compose, AddGaussianNoise, TimeStretch, PitchShift, Shift
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),
    Shift(p=0.5),
])

# Generate 2 seconds of dummy audio for the sake of example
samples = np.random.uniform(low=-0.2, high=0.2, size=(32000,)).astype(np.float32)

# Augment/transform/perturb the audio data
augmented_samples = augment(samples=samples, sample_rate=16000)

Documentation

The API documentation, along with guides, example code, illustrations and example sounds, is available at https://iver56.github.io/audiomentations/

Transforms

  • AddBackgroundNoise: Mixes in another sound to add background noise
  • AddColorNoise: Adds noise with specific color
  • AddGaussianNoise: Adds gaussian noise to the audio samples
  • AddGaussianSNR: Injects gaussian noise using a randomly chosen signal-to-noise ratio
  • AddShortNoises: Mixes in various short noise sounds
  • AdjustDuration: Trims or pads the audio to fit a target duration
  • AirAbsorption: Applies frequency-dependent attenuation simulating air absorption
  • Aliasing: Produces aliasing artifacts by downsampling without low-pass filtering and then upsampling
  • ApplyImpulseResponse: Convolves the audio with a randomly chosen impulse response
  • BandPassFilter: Applies band-pass filtering within randomized parameters
  • BandStopFilter: Applies band-stop (notch) filtering within randomized parameters
  • BitCrush: Applies bit reduction without dithering
  • Clip: Clips audio samples to specified minimum and maximum values
  • ClippingDistortion: Distorts the signal by clipping a random percentage of samples
  • Gain: Multiplies the audio by a random gain factor
  • GainTransition: Gradually changes the gain over a random time span
  • HighPassFilter: Applies high-pass filtering within randomized parameters
  • HighShelfFilter: Applies a high shelf filter with randomized parameters
  • Lambda: Applies a user-defined transform
  • Limiter: Applies dynamic range compression limiting the audio signal
  • LoudnessNormalization: Applies gain to match a target loudness
  • LowPassFilter: Applies low-pass filtering within randomized parameters
  • LowShelfFilter: Applies a low shelf filter with randomized parameters
  • Mp3Compression: Compresses the audio to lower the quality
  • Normalize: Applies gain so that the highest signal level becomes 0 dBFS
  • Padding: Replaces a random part of the beginning or end with padding
  • PeakingFilter: Applies a peaking filter with randomized parameters
  • PitchShift: Shifts the pitch up or down without changing the tempo
  • PolarityInversion: Flips the audio samples upside down, reversing their polarity
  • RepeatPart: Repeats a subsection of the audio a number of times
  • Resample: Resamples the signal to a randomly chosen sampling rate
  • Reverse: Reverses the audio along its time axis
  • RoomSimulator: Simulates the effect of a room on an audio source
  • SevenBandParametricEQ: Adjusts the volume of 7 frequency bands
  • Shift: Shifts the samples forwards or backwards
  • TanhDistortion: Applies tanh distortion to distort the signal
  • TimeMask: Makes a random part of the audio silent
  • TimeStretch: Changes the speed without changing the pitch
  • Trim: Trims leading and trailing silence from the audio

Changelog

[0.43.1] - 2025-09-13

Fixed

  • Fix a bug introduced in 0.43.0 where the noise added by AddBackgroundNoise had wrong offset if the noise was longer than the given signal.

For the full changelog, including older versions, see https://iver56.github.io/audiomentations/changelog/

Acknowledgements

Thanks to all contributors who help improving audiomentations.

Related repositories
huggingface/transformers

🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.

PythonPyPIApache License 2.0nlpnatural-language-processing
huggingface.co/transformers
162.8k34k
FFmpeg/FFmpeg

Mirror of https://git.ffmpeg.org/ffmpeg.git

COtherffmpegvideo
ffmpeg.org
62.3k14k
mpv-player/mpv

🎥 Command line media player

COthermpvmplayer
mpv.io
36.1k3.4k
OpenBMB/VoxCPM

VoxCPM2: Tokenizer-Free TTS for Multilingual Speech Generation, Creative Voice Design, and True-to-Life Cloning

PythonPyPIApache License 2.0audiodeeplearning
voxcpm.com
34k3.9k
ossrs/srs

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181, with codec support for H.264, H.265, AV1, VP9, AAC, Opus, and G.711.

C++MIT Licensertmplive-streaming
ossrs.io
29.1k5.7k
Anjok07/ultimatevocalremovergui

GUI for a Vocal Remover that uses Deep Neural Networks.

PythonPyPIMIT Licensevocal-removerpytorch
25.5k1.9k
goldfire/howler.js

Javascript audio library for the modern web.

JavaScriptnpmMIT Licensejavascriptaudio
howlerjs.com
25.3k2.3k
ExistentialAudio/BlackHole

BlackHole is a modern macOS audio loopback driver that allows applications to pass audio to other applications with zero additional latency.

COtheraudiodriver
19.4k828
modelscope/FunASR

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

PythonPyPIMIT Licensepytorchspeech-recognition
modelscope.github.io/FunASR/
19.4k1.9k
kyleneideck/BackgroundMusic

Background Music, a macOS audio utility: automatically pause your music, set individual apps' volumes and record system audio.

C++GNU General Public License v2.0audioaudio-utility
19.2k775
alyssaxuu/screenity

The free and privacy-friendly screen recorder with no limits 🎥

JavaScriptnpmGNU General Public License v3.0screen-capturescreencast
screenity.io
18.4k1.5k
mahmoud/awesome-python-applications

💿 Free software that works great, and also happens to be open-source Python.

Jupyter Notebookpythonapplication
ftp//you:relookin@it
17.9k2.7k