skillfed

torch-audiomentations

A Pytorch library for audio data augmentation. Inspired by audiomentations. Useful for deep learning.

torch-audiomentations v0.12.0 2.1M downloads/30d#3,273 on PyPI1,164
Permissive license MIT AGING released

What it is and what it does

torch-audiomentations is a PyTorch library for augmenting audio data during training. It provides a collection of transforms—gain adjustment, filtering, pitch shifting, noise addition, and more—that extend nn.Module and can be composed into a pipeline. Most transforms are differentiable and support batches of multichannel audio, running efficiently on both CPU and GPU. The library is designed to avoid becoming a bottleneck in model training.

The transforms support three application modes (per_batch, per_example, per_channel) and probability-based triggering, giving fine control over how augmentation is applied to different samples in a batch. It is inspired by the audiomentations library but optimized for PyTorch workflows. The package is in early development (alpha status), so APIs may change, and some features like target data processing and multi-GPU support remain experimental or unsupported.

Use it for:

  • Augment audio batches during training of speech recognition or audio classification models to improve robustness.
  • Apply differentiable transforms as part of an end-to-end learnable audio processing pipeline.
  • Add background noise, pitch variation, or filtering to synthetic training data for audio ML tasks.
  • Accelerate augmentation on GPU to reduce training bottlenecks when processing large audio datasets.
  • Compose multiple transforms (gain, filtering, polarity inversion) into a single augmentation routine.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides PyTorch-native audio data augmentation transforms that run on CPU or GPU, designed to integrate directly into neural network models as differentiable modules.

Yes, if you are training audio models with PyTorch and need GPU-accelerated augmentation. The library is mature enough for production use (1164 GitHub stars, top 5000 PyPI packages), has no known vulnerabilities, and offers a permissive license. However, be aware that maintenance is aging (last release 576 days ago), multiprocessing and multi-GPU setups have known limitations, and some transforms have edge cases (e.g., PitchShift at low sample rates). For single-GPU training on CPU or GPU, it is a solid choice.

Install

torch-audiomentations on PyPI

pip

pip install torch-audiomentations

uv

uv add torch-audiomentations

poetry

poetry add torch-audiomentations

Installing torch-audiomentations

Before you install

Low friction install with a pure Python wheel. Maintenance status is aging—last release was 576 days ago—but the repository remains active with recent commits and no archived status. The four runtime dependencies (torch, torchaudio, julius, torch-pitch-shift) are standard in audio ML workflows.

License in practice

MIT license is permissive; you can use this package freely in commercial and private projects without restriction or attribution requirement.

Quickstart

pip install torch-audiomentations

import torch
from torch_audiomentations import Compose, Gain, PolarityInversion

apply_augmentation = Compose([
    Gain(min_gain_in_db=-15.0, max_gain_in_db=5.0, p=0.5),
    PolarityInversion(p=0.5)
])

audio_samples = torch.rand(8, 2, 32000, dtype=torch.float32) - 0.5
perturbed = apply_augmentation(audio_samples, sample_rate=16000)

Requires torch and torchaudio installed; multiprocessing contexts may cause memory leaks and multi-GPU/DDP is not officially supported.

Verify before relying

  • Whether PitchShift limitations (small shifts at low sample rates) affect your intended use case.
  • Performance characteristics of specific transforms on your hardware (GPU speedup varies by transform).
  • Stability of target data processing, still marked experimental in the documentation.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 4 — julius, torch, torchaudio, torch-pitch-shift
Maintenance aging — 576 days since the last release
Last repo commit
First released
Downloads 2,125,883/month — #3,273 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: torch_audiomentations-0.12.0-py3-none-any.whl

Development Status :: 3 - AlphaIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Topic :: MultimediaTopic :: Multimedia :: Sound/AudioTopic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Artificial Intelligence

Tags

pytorch audio augmentationaudio data augmentation deep learninggpu audio transformsbatch audio processing pytorchdifferentiable audio augmentationmultichannel audio augmentationaudio preprocessing neural networks
audio-augmentationgpu-accelerateddeep-learning

More Scientific/Engineering packages

Further reading