← Open Source
facebookresearch

WavAugment

A library for speech data augmentation in time-domain.

Model DevelopmentDataset engineeringPython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
688
Stars
60
Forks
+0
This week
2
Contributors
Created 2020-06-26 · Updated 2026-08-20 · #14984 today
Top developers
eugene-kharitonovvincentqb

facebookresearch/WavAugment is ranked 14,984 with 688 stars.

Same-category comparison

facebookresearch/WavAugment is ranked 14,984 among these 8 peers; atcbosselut/comet-commonsense is ranked 14,982.

Same-category comparison
NameRankMetrics
lyndonzheng/Pluralistic-Inpainting14,973
Language:
Python
Stars:
689
Forks:
145
Description:
[CVPR 2019]: Pluralistic Image Completion.
nyu-systems/Grendel-GS14,974
Language:
Python
Stars:
689
Forks:
43
Description:
[ICLR 2025 Oral] On Scaling Up 3D Gaussian Splatting Training.
wichtounet/dll14,977
Language:
C++
Stars:
689
Forks:
157
atcbosselut/comet-commonsense14,982
Language:
Python
Stars:
688
Forks:
124
Description:
Code for ACL 2019 Paper: "COMET: Commonsense Transformers for Automatic Knowledge Graph Construction" https://arxiv.org/abs/1906.05317.
twjiang/graphSAGE-pytorch14,987
Language:
Python
Stars:
688
Forks:
150
Description:
A PyTorch implementation of GraphSAGE. This package contains a PyTorch implementation of GraphSAGE.
Ha0Tang/AttentionGAN14,991
Language:
Python
Stars:
687
Forks:
100
Description:
AttentionGAN for Unpaired Image-to-Image Translation & Multi-Domain Image-to-Image Translation.
wenbowen123/BundleTrack14,999
Language:
C++
Stars:
687
Forks:
72
Description:
[IROS 2021] BundleTrack: 6D Pose Tracking for Novel Objects without Instance or Category-Level 3D Models.
inspirehep/magpie15,009
Language:
Python
Stars:
686
Forks:
188
Description:
Deep neural network framework for multi-label text classification.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryModel Development
SubcategoryDataset engineering
KeywordsAudio production, Data synthesis
Stars688
Forks60
Contributors2
Created date2020-06-26
Updated date2026-08-20
Stars in 1 day0
Stars in 7 days0
Rank14,984
Previous rank14,813
Rank change-171
7-day stars rank14,749
Previous 7-day stars rank14,761
7-day stars rank change12
Total stars rank15,084
Previous total stars rank15,055
Total stars rank change-29
CountryUSA
README summary

WavAugment WavAugment performs data augmentation on audio data. The audio data is represented as pytorch tensors. It is particularly useful for speech data. Among others, it implements the augmentations that we found to be most useful for self-supervised learning (_Data Augmenting Contrastive Learning of Speech Representations in the Time Domain_, E. [[arxiv]]( Pitch randomization, Reverberation, Additive noise, Time dropout (temporal masking), Band reject, Clipping Internally, WavAugment uses libsox and allows interleaving of libsox- and pytorch-based effects. Requirements Linux

or MacOS pytorch >= 1. 7 Installation To install WavAugment, run the following command: Testing Requires pytest ( ) Usage First of all, we provide thouroughly documented examples, where we demonstrate how a data-augmented dataset interface works. We also provide a Jupyter-based tutorial (open in colab) that illlustrates how one can apply various useful effects to a piece of speech (recorded over the mic or pre-recorded). The The central object is the chain of effects, , that are applied on a

to produce another . This chain can have multiple effects composed: Parameters of the effect coincide with those of libsox ( however, you can also randomize the parameters by providing a python and mix them with standard parameters: Here, the flag makes run faster at some expense of the quality. If some parameters are provided by a Callable, this Callable will be invoked every time is applied (eg. Applying the chain To apply a chain of effects on a torch. Tensor, we

code the following: WavAugment expects to have a shape of (channels, length). As does not contain important meta-information, such as sampling rate, we need to provide it manually. This is done by passing two dictionaries, (meta-information about the input format) and (our expectated format for the output). At minimum, we need to set the sampling rate for the input tensor: . Example usage Below is a small gist of a potential usage: Important notes It often happens that a

command-line invocation of sox would change effect chain. To get a better idea of what sox executes internally, you can launch it with a -V flag, eg by running: we will see something like: This output tells us that the effect changes the number of channels, which are squashed into 1 channel by the effect. Sox also added effect to hide processing artifacts. WavAugment remains explicit and doesn't add effects under the hood. If you want to emulate a

Sox command that decomposes into several effects, we advise to consult and apply the effects manually. Try it out on some files before running a heavy machine-learning job. Citation If you find WavAugment useful in your research, please consider citing: Contributing See the CONTRIBUTING file for how to help out. License WavAugment is MIT licensed, as found in the LICENSE file.

Frequently asked questions

How many stars and forks are recorded?

facebookresearch/WavAugment has 688 stars and 60 forks.

What is the repository rank?

facebookresearch/WavAugment is ranked 14,984.

What language and category are recorded?

facebookresearch/WavAugment has 688 stars, uses Python and belongs to Model Development.

Which repository is closest in rank?

facebookresearch/WavAugment is compared with atcbosselut/comet-commonsense, ranked 14,982 with 688 stars.

README

WavAugment

WavAugment performs data augmentation on audio data. The audio data is represented as pytorch tensors.

It is particularly useful for speech data. Among others, it implements the augmentations that we found to be most useful for self-supervised learning (Data Augmenting Contrastive Learning of Speech Representations in the Time Domain, E. Kharitonov, M. Rivière, G. Synnaeve, L. Wolf, P.-E. Mazaré, M. Douze, E. Dupoux. [arxiv]):

  • Pitch randomization,
  • Reverberation,
  • Additive noise,
  • Time dropout (temporal masking),
  • Band reject,
  • Clipping

Internally, WavAugment uses libsox and allows interleaving of libsox- and pytorch-based effects.

Requirements

Installation

To install WavAugment, run the following command:

git clone git@github.com:facebookresearch/WavAugment.git && cd WavAugment && python setup.py develop

Testing

Requires pytest (pip install pytest)

python -m pytest -v --doctest-modules

Usage

First of all, we provide thouroughly documented examples, where we demonstrate how a data-augmented dataset interface works. We also provide a Jupyter-based tutorial (open in colab) that illlustrates how one can apply various useful effects to a piece of speech (recorded over the mic or pre-recorded).

The EffectChain

The central object is the chain of effects, EffectChain, that are applied on a torch.Tensor to produce another torch.Tensor. This chain can have multiple effects composed:

import augment
effect_chain = augment.EffectChain().pitch(100).rate(16_000)

Parameters of the effect coincide with those of libsox (http://sox.sourceforge.net/libsox.html); however, you can also randomize the parameters by providing a python Callable and mix them with standard parameters:

import numpy as np
random_pitch_shift = lambda: np.random.randint(-100, +100)
# the pitch will be changed by a shift somewhere between (-100, +100)
effect_chain = augment.EffectChain().pitch("-q", random_pitch_shift).rate(16_000)

Here, the flag-q makes pitch run faster at some expense of the quality. If some parameters are provided by a Callable, this Callable will be invoked every time EffectChain is applied (eg. to generate random parameters).

Applying the chain

To apply a chain of effects on a torch.Tensor, we code the following:

output_tensor = augment.EffectChain().pitch(100).rate(16_000).apply(input_tensor, \
    src_info=src_info, target_info=target_info)

WavAugment expects input_tensor to have a shape of (channels, length). As input_tensor does not contain important meta-information, such as sampling rate, we need to provide it manually. This is done by passing two dictionaries, src_info (meta-information about the input format) and target_info (our expectated format for the output).

At minimum, we need to set the sampling rate for the input tensor: {'rate': 16_000}.

Example usage

Below is a small gist of a potential usage:

import augment
import numpy as np

x, sr = torchaudio.load(test_wav)

# input signal properties
src_info = {'rate': sr}

# output signal properties
target_info = {'channels': 1, 
               'length': 0, # not known beforehand
               'rate': 16_000}
# write down the chain of effects with their string parameters and call .apply()
# effects are specified as a chain of method calls with parameters that can be 
# strings, numbers, or callables. The latter case is used for generating randomized
# transformations
random_pitch = lambda: np.random.randint(-400, -200)
y = augment.EffectChain().pitch(random_pitch).rate(16_000).apply(x, \
    src_info=src_info, target_info=target_info)

Important notes

It often happens that a command-line invocation of sox would change effect chain. To get a better idea of what sox executes internally, you can launch it with a -V flag, eg by running:

sox -V tests/test.wav out.wav reverb 0 50 100

we will see something like:

sox INFO sox: effects chain: input        16000Hz  1 channels
sox INFO sox: effects chain: reverb       16000Hz  2 channels
sox INFO sox: effects chain: channels     16000Hz  1 channels
sox INFO sox: effects chain: dither       16000Hz  1 channels
sox INFO sox: effects chain: output       16000Hz  1 channels

This output tells us that the reverb effect changes the number of channels, which are squashed into 1 channel by the channel effect. Sox also added dither effect to hide processing artifacts.

WavAugment remains explicit and doesn't add effects under the hood. If you want to emulate a Sox command that decomposes into several effects, we advise to consult sox -V and apply the effects manually. Try it out on some files before running a heavy machine-learning job.

Citation

If you find WavAugment useful in your research, please consider citing:

@article{wavaugment2020,
  title={Data Augmenting Contrastive Learning of Speech Representations in the Time Domain},
  author={Kharitonov, Eugene and Rivi{\`e}re, Morgane and Synnaeve, Gabriel and Wolf, Lior and Mazar{\'e}, Pierre-Emmanuel and Douze, Matthijs and Dupoux, Emmanuel},
  journal={arXiv preprint arXiv:2007.00991},
  year={2020}
}

Contributing

See the CONTRIBUTING file for how to help out.

License

WavAugment is MIT licensed, as found in the LICENSE file.

Nearby in the ranking
Similar items