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

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

Setup

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)

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.7.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

audiomentations-0.7.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for audiomentations-0.7.0.tar.gz
Algorithm Hash digest
SHA256 dee42a80e412ecd7eee47d3463404df4b0e35a88ded8cd4b05f81b7ff63a1bc9
MD5 f0b98b9b6071ddb6a37acdb4d6a9a942
BLAKE2b-256 ec50ddfb4d6c1066c784f47ee966d854a6b5897ba37db6df109866628e77af48

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for audiomentations-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ca333b724516200b547981a7b97ff7ace98c84e6a1276cabae13a5f6d050605
MD5 f8e454ad82210097a29880cc5acfa641
BLAKE2b-256 c0bcb1d8a8875969980c9afa917bb4073e33fb64d5e5b51686fa00b6b771f9c9

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