Skip to main content

Audio augmentations library, for audio in the time-domain.

Project description

Audio Augmentations

Audio augmentations library for PyTorch for audio in the time-domain, with support for stochastic data augmentations as used often in self-supervised / contrastive learning.

Usage

We can define several audio augmentations, which will be applied sequentially to a raw audio waveform:

transforms = [
    RandomResizedCrop(n_samples=audio_length),
    PolarityInversion(p=0.8),
    # Noise(p=0.1),
    Gain(p=0.3),
    HighLowPass(p=0.8, sr=sample_rate),
    Delay(p=0.4, sr=sample_rate),
    PitchShift(
        audio_length=audio_length,
        p=0.6,
        sr=sample_rate,
    )
    Reverb(p=0.6, sr=sample_rate)
]

We can return either one or many versions of the same audio example:

audio = torchaudio.load("testing/classical.00002.wav")
transform = Compose(transforms=transforms)
transformed_audio =  transform(audio)
>> transformed_audio.shape[0] = 1
audio = torchaudio.load("testing/classical.00002.wav")
transform = ComposeMany(transforms=transforms, num_augmented_samples=4)
transformed_audio = transform(audio)
>> transformed_audio.shape[0] = 4

Similar to the torchvision.datasets interface, an instance of the Compose or ComposeMany class can be supplied to a torchaudio dataloaders that accept transform=.

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

audio-augmentations-0.1.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

audio_augmentations-0.1.2-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file audio-augmentations-0.1.2.tar.gz.

File metadata

  • Download URL: audio-augmentations-0.1.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.4

File hashes

Hashes for audio-augmentations-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c01e434494b0b356a4c2255b2f258936bda3b36fe3cb1732a4551d5153f36a8d
MD5 824bff01b8cd3898510b0a453bbff70c
BLAKE2b-256 cf585fd87c31020cc4e473d28f136c77190d39f8bf76f4efbe7b70eb8175d89c

See more details on using hashes here.

File details

Details for the file audio_augmentations-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: audio_augmentations-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.4

File hashes

Hashes for audio_augmentations-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7977cce973c33805360e5c85626671e80ca8f7f0d1a3f9130ac34cc402aeb6b6
MD5 533231803ac7398c0a9d903c4930997f
BLAKE2b-256 a8b947f0cb3b1c79a26f08315005ef5bc1fada7246414f2106795cf96a114a9e

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