Skip to main content

A Python library for audio data augmentation. Inspired by albumentations. Useful for machine learning.

Project description

Audiomentations

Build status Code coverage Code Style: Black Licence: MIT

A Python library for audio data augmentation. Inspired by albumentations. Useful for machine learning.

Setup

Python version support PyPI version Number of downloads from PyPI per month

pip install audiomentations

Usage example

from audiomentations import Compose, AddGaussianNoise, TimeStretch, PitchShift, Shift
import numpy as np

SAMPLE_RATE = 16000

augmenter = 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(min_fraction=-0.5, max_fraction=0.5, p=0.5),
])

samples = np.zeros((20,), dtype=np.float32)
samples = augmenter(samples=samples, sample_rate=SAMPLE_RATE)

Go to audiomentations/augmentations/transforms.py to see which transforms you can apply.

Development

Install the dependencies specified in requirements.txt

Code style

Format the code with black

Run tests and measure code coverage

pytest

Generate demo sounds for empirical evaluation

python -m demo.demo

Alternatives

Project details


Download files

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

Source Distribution

audiomentations-0.9.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

audiomentations-0.9.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file audiomentations-0.9.0.tar.gz.

File metadata

  • Download URL: audiomentations-0.9.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.7.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6

File hashes

Hashes for audiomentations-0.9.0.tar.gz
Algorithm Hash digest
SHA256 05cb2122c3f75274531011760bd2001f198af649b36eb443f3e56235880197e2
MD5 a24e07044d5d2c955af2ffeb1a1998d8
BLAKE2b-256 78227ce28f15171fd8d163b00eebf2b07a8469ca32ae72fd6c0f08e8e5cc791b

See more details on using hashes here.

File details

Details for the file audiomentations-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: audiomentations-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.7.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6

File hashes

Hashes for audiomentations-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 758dfa2c671b4a1dc4fab08ac11e2868171f91dc62b9fb5a32b74af38c49db27
MD5 350db8f023b09bfb0244d5c2bff0df08
BLAKE2b-256 3ede96480a0616841dcfa78d79b31640f2accbe9696dc50b625f4774fbf37733

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page