Skip to main content

Wav2Aug: A Drop-In Speech Augmentation Policy

A minimalistic PyTorch-based augmentation library for speech augmentation. The goal of this library is to provide a drop-in speech augmentation policy that can be used on any task and perform reasonably well without having to tune augmentation hyperparameters. Just install, and start augmenting. Applies two random augmentations per call. Just install and start augmenting!

Our experiments show that Wav2Aug performs comparably to SpecAugment on ASR and better on average across the evaluated non-ASR tasks. See our paper for details.

Diagram

Installation

Requires Python 3.10+ and FFmpeg shared libraries for TorchCodec audio decoding. Install FFmpeg before running the quick start:

# macOS (Homebrew)
brew install ffmpeg

# Ubuntu / Debian
sudo apt-get update && sudo apt-get install -y ffmpeg

For Windows and other platforms, follow the TorchCodec installation instructions. If installing into an existing PyTorch environment, check TorchCodec's compatibility table for your PyTorch version.

pip

pip install wav2aug

uv

uv add wav2aug

Quick Start

import torch
from wav2aug.gpu import Wav2Aug

# Initialize the augmenter once
augmenter = Wav2Aug(sample_rate=16000)

# in the forward pass
wavs = torch.randn(3, 50000)
lens = torch.ones((wavs.size(0)))

aug_wavs, aug_lens = augmenter(wavs, lens)

# or just

aug_wavs = augmenter(wavs)

That's it!

By default, each call samples two augmentations with replacement from the top six (top_k=6) and applies them sequentially. The same operation can be selected twice, with random parameters sampled independently for each application. Set top_k=9 to sample from all nine augmentations, or top_k=1 to apply noise addition once.

The first initialization downloads a roughly 569 MB noise archive from Hugging Face and preloads the decoded audio into RAM. Later initializations reuse the downloaded files. Set WAV2AUG_DATA_DIR before importing wav2aug to change the cache location (default: ~/.cache/wav2aug), or supply your own audio directory to avoid downloading:

augmenter = Wav2Aug(sample_rate=16000, noise_dir="/path/to/noise")

Augmentation Types

  • Amplitude Scaling/Clipping: Random gain and peak limiting
  • Noise Addition: Environmental noise with SNR control
  • Frequency Dropout: Spectral masking with random notch filters
  • Polarity Inversion: Random phase flip
  • Chunk Swapping: Temporal segment reordering
  • Speed Perturbation: Time-scale modification
  • Time Dropout: Random silence insertion
  • Babble Noise: Multi-speaker background (auto-enabled with sufficient buffer)

Randomness: all stochastic ops use PyTorch RNGs. Set a single seed and be done, e.g. torch.manual_seed(0); torch.cuda.manual_seed_all(0)

Development Installation

uv

git clone https://github.com/gfdb/wav2aug
cd wav2aug

# create venv and pin Python
uv venv
source .venv/bin/activate
uv python pin 3.10  # or 3.11/3.12

# runtime only
uv sync

# extras
uv sync --extra dev
uv sync --extra test

pip

git clone https://github.com/gfdb/wav2aug
cd wav2aug

# create venv
python -m venv .venv
source .venv/bin/activate

# runtime only
python -m pip install .

# editable + extras for development
python -m pip install -e '.[dev,test]'

Tests

uv

uv run pytest -q tests/

pip

pytest -q tests/

Contributing

  • Feel free to open a PR!

  • Bug reports: please open an issue with a minimal repro (env, dep versions, code snippet, expected vs. actual, traceback, etc.)

Metadata

Release files for wav2aug 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wav2aug 0.0.5
File Size Uploaded Provenance Actions
wav2aug-0.0.5.tar.gz 25.3 kB With provenance Details for wav2aug-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wav2aug 0.0.5
File Interpreter ABI Platform Actions
wav2aug-0.0.5-py3-none-any.whl Python 3 none any Details for wav2aug-0.0.5-py3-none-any.whl

Total release size: 52.2 kB

Release files / wav2aug-0.0.5.tar.gz

Download URL wav2aug-0.0.5.tar.gz
Size 25.3 kB
Tags Source
SHA-256 checksum
How to use checksums
73e278a3a4e404950c4412b22d10d066bbec3cff5afd64e6c4fec256c26f0971
BLAKE2b-256 checksum
How to use checksums
4e795ba6c91ef59b26046f794113e5d8f5b7f96bd29cd1d7bc931abbd827739a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / wav2aug-0.0.5-py3-none-any.whl

Download URL wav2aug-0.0.5-py3-none-any.whl
Size 26.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d18a5824e772e8cca7643bce5c0f1a595e660b407c001a3f72d238ddc89b6d7b
BLAKE2b-256 checksum
How to use checksums
e36b83131c39241c00dd97ec05cbead25c813345a4f79de4388b755e26c673fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for wav2aug 0.0.5

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for wav2aug-0.0.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page