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

Uploaded Source

File details

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

File metadata

  • Download URL: audio-augmentations-0.1.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.3.3.post20210118 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5

File hashes

Hashes for audio-augmentations-0.1.1.tar.gz
Algorithm Hash digest
SHA256 96552de16fe6a55d63eb9841eb3ce322b29864b59e0a4273b5255bda852b0bb6
MD5 9c65e6eef543696c63edd7bbf554ed0b
BLAKE2b-256 eb20fdc18cbb7e94f46a0234a281e605737b8cdf30f2666dee374af8d909c3c2

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