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:
from audio_augmentations import *
audio, sr = torchaudio.load("tests/classical.00002.wav")
num_samples = sr * 5
transforms = [
RandomResizedCrop(n_samples=num_samples),
RandomApply([PolarityInversion()], p=0.8),
RandomApply([Noise(min_snr=0.3, max_snr=0.5)], p=0.3),
RandomApply([Gain()], p=0.2),
RandomApply([HighLowPass(sample_rate=sr)], p=0.8),
RandomApply([Delay(sample_rate=sr)], p=0.5),
RandomApply([PitchShift(
n_samples=num_samples,
sample_rate=sr
)], p=0.4),
RandomApply([Reverb(sample_rate=sr)], p=0.3)
]
We can return either one or many versions of the same audio example:
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=.
Optional
Install WavAugment for reverberation / pitch shifting:
pip install git+https://github.com/facebookresearch/WavAugment
Metadata
Release files for audio-augmentations 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| audio-augmentations-0.1.3.tar.gz | 8.2 kB | Without provenance | Details for audio-augmentations-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| audio_augmentations-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for audio_augmentations-0.1.3-py3-none-any.whl |
Total release size: 17.4 kB
Release files / audio-augmentations-0.1.3.tar.gz
| Download URL | audio-augmentations-0.1.3.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6f134f32d109c38570b47fb7f0e10646178efbb8df5fa6ad267d66eb99376b70
|
|
BLAKE2b-256 checksum How to use checksums |
ef1309c5ffdf2c7eae92ad5718fb4d1c4e7fbcbae12dd1ce5b28a9d84474b7ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
|
Release files / audio_augmentations-0.1.3-py3-none-any.whl
| Download URL | audio_augmentations-0.1.3-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2c048029c2d565a0b54d0a1bd33df39aab29cee22eb6634353a94a1e2f734b0e
|
|
BLAKE2b-256 checksum How to use checksums |
b89926d6faea82b1465faa3a630ba6de5fcf9639a122810b800c6816fe5090c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6
|
Security for audio-augmentations 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.