--- id: torch-audiomentations version: "0.12.0" license: MIT license_treatment: permissive maintenance: aging --- # torch-audiomentations — A Pytorch library for audio data augmentation. Inspired by audiomentations. Useful for deep learning. License: permissive · Maintenance: aging · Downloads: 2.1M/mo ## 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 above — 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 pip install torch-audiomentations uv add torch-audiomentations 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_current - Install friction: low - Maintenance: aging - Downloads: 2.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags pytorch audio augmentation, audio data augmentation deep learning, gpu audio transforms, batch audio processing pytorch, differentiable audio augmentation, multichannel audio augmentation, audio preprocessing neural networks, audio-augmentation, gpu-accelerated, deep-learning [View on SkillFed](https://skillfed.io/packages/torch-audiomentations) · [View on PyPI](https://pypi.org/project/torch-audiomentations/)