Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Tool to introduce controlled degradations to audio

Project description

Build Status


Latest version: 1.2.3

Audio degradation toolbox in python, with a command-line tool. It is useful to apply controlled degradations to audio.


pip install audio_degrader

The program depends on sox, ffmpeg and rubberband, so you might need to install them as well. Recommended brew in OSX and apt-get in linux (for rubberband, in linux use rubberband-cli).

Usage of python package

import audio_degrader as ad
audio_file = ad.AudioFile('input.wav', './tmp_dir')
for d in ad.ALL_DEGRADATIONS.values():
    print ad.DegradationUsageDocGenerator.get_degradation_help(d)
degradations = ad.ParametersParser.parse_degradations_args([
for d in degradations:

Usage of command-line tool

The script audio_degrader is installed along with the python package.

# e.g. mix with restaurant08.wav with snr=10db, then amplifies 6db, then compress dynamic range
$ audio_degrader -i input.mp3 -d mix,,10 gain,6 dr_compression,3 -o out.wav

# for more details:
$ audio_degrader --help

A small set of sounds and impulse responses are installed along with the script, which can be listed with:

$ audio_degrader -l

# these relative paths can be used directly in the script too:
$ audio_degrader -i input.mp3 -d mix,sounds/applause.wav,-3 gain,6 -o out.wav


  • Evaluate Music Information Retrieval systems under different degrees of degradations
  • Prepare augmented data for training of machine learning systems

It is similar to the Audio Degradation Toolbox in Matlab by Sebastian Ewert and Matthias Mauch (for Matlab).

Some examples

# Mix input with a sound / noise (e.g. using installed resources)
$ audio_degrader -i input.wav -d mix,sounds/applause.wav,-3 -o out.wav

# Instead of paths, we can also use URLs
$ audio_degrader -i input.wav -d mix,,-3 -o out.wav

# Microphone recording style
$ audio_degrader -i input.wav -d gain,-15 mix,sounds/ambience-pub.wav,18 convolution,impulse_responses/ir_smartphone_mic_mono.wav,0.8 dr_compression,2 equalize,50,100,-6 normalize -o out.wav

# Resample and normalize
$ audio_degrader -i input.mp3 -d resample,8000 normalize -o out.wav

# Convolution (again impulse responses can be resources, full paths or URLs)
$ audio_degrader -i input.wav -d convolution,impulse_responses/ir_classroom_mono.wav,0.7 -o out.wav
$ audio_degrader -i input.wav -d convolution,,0.7 -o out.wav

Audio formats


audio_degrader relies on ffmpeg for audio reading, so it can read any format (even video).


audio_degrader output format is always wav stereo pcm_f32le (sample rate from original audio file).

This output wav file can be easily coverted into another format with ffmpeg, e.g.:

$ ffmpeg -i out.wav -b:a 320k out.mp3
$ ffmpeg -i out.wav -ac 2 -ar 44100 -acodec pcm_s16le out_formatted.wav

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for audio-degrader, version 1.2.3
Filename, size File type Python version Upload date Hashes
Filename, size audio_degrader-1.2.3-py2-none-any.whl (19.0 MB) File type Wheel Python version py2 Upload date Hashes View hashes
Filename, size audio_degrader-1.2.3.tar.gz (24.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page