Audio Save

Data manipulation and transformation for audio signal processing, powered by PyTorch

Project README

torchaudio: an audio library for PyTorch

Build Status Documentation Anaconda Badge Anaconda-Server Badge

TorchAudio Logo

The aim of torchaudio is to apply PyTorch to the audio domain. By supporting PyTorch, torchaudio follows the same philosophy of providing strong GPU acceleration, having a focus on trainable features through the autograd system, and having consistent style (tensor names and dimension names). Therefore, it is primarily a machine learning library and not a general signal processing library. The benefits of PyTorch can be seen in torchaudio through having all the computations be through PyTorch operations which makes it easy to use and feel like a natural extension.


  • PyTorch (See below for the compatible versions)
  • [optional] vesis84/kaldi-io-for-python commit cb46cb1f44318a5d04d4941cf39084c5b021241e or above

The following are the corresponding torchaudio versions and supported Python versions.

torch torchaudio python
Development master / nightly main / nightly >=3.7, <=3.10
Latest versioned release 1.13.0 0.13.0 >=3.7, <=3.10
Previous versions
torch torchaudio python
1.12.1 0.12.1 >=3.7, <=3.10
1.12.0 0.12.0 >=3.7, <=3.10
1.11.0 0.11.0 >=3.7, <=3.9
1.10.0 0.10.0 >=3.6, <=3.9
1.9.1 0.9.1 >=3.6, <=3.9
1.9.0 0.9.0 >=3.6, <=3.9
1.8.1 0.8.1 >=3.6, <=3.9
1.8.0 0.8.0 >=3.6, <=3.9
1.7.1 0.7.2 >=3.6, <=3.9
1.7.0 0.7.0 >=3.6, <=3.8
1.6.0 0.6.0 >=3.6, <=3.8
1.5.0 0.5.0 >=3.5, <=3.8
1.4.0 0.4.0 ==2.7, >=3.5, <=3.8


Binary Distributions

torchaudio has binary distributions for PyPI (pip) and Anaconda (conda).

Please refer to for the details.

Note Starting 0.10, torchaudio has CPU-only and CUDA-enabled binary distributions, each of which requires a matching PyTorch version.

Note This software was compiled against an unmodified copy of FFmpeg (licensed under the LGPLv2.1), with the specific rpath removed so as to enable the use of system libraries. The LGPL source can be downloaded here.

From Source

On non-Windows platforms, the build process builds libsox and codecs that torchaudio need to link to. It will fetch and build libmad, lame, flac, vorbis, opus, and libsox before building extension. This process requires cmake and pkg-config. libsox-based features can be disabled with BUILD_SOX=0. The build process also builds the RNN transducer loss and CTC beam search decoder. These functionalities can be disabled by setting the environment variable BUILD_RNNT=0 and BUILD_CTC_DECODER=0, respectively.

# Linux
python install

CC=clang CXX=clang++ python install

# Windows
# We need to use the MSVC x64 toolset for compilation, with Visual Studio's vcvarsall.bat or directly with vcvars64.bat.
# These batch files are under Visual Studio's installation folder, under 'VC\Auxiliary\Build\'.
# More information available at:
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 && set BUILD_SOX=0 && python install
# or
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" && set BUILD_SOX=0 && python install

This is known to work on linux and unix distributions such as Ubuntu and CentOS 7 and macOS. If you try this on a new system and find a solution to make it work, feel free to share it by opening an issue.

Quick Usage

import torchaudio

waveform, sample_rate = torchaudio.load('foo.wav')  # load tensor from file'foo_save.wav', waveform, sample_rate)  # save tensor to file

Backend Dispatch

By default in OSX and Linux, torchaudio uses SoX as a backend to load and save files. The backend can be changed to SoundFile using the following. See SoundFile for installation instructions.

import torchaudio
torchaudio.set_audio_backend("soundfile")  # switch backend

waveform, sample_rate = torchaudio.load('foo.wav')  # load tensor from file, as usual'foo_save.wav', waveform, sample_rate)  # save tensor to file, as usual


  • SoundFile currently does not support mp3.
  • "soundfile" backend is not supported by TorchScript.

API Reference

API Reference is located here:

Contributing Guidelines

Please refer to


If you find this package useful, please cite as:

  title={TorchAudio: Building Blocks for Audio and Speech Processing},
  author={Yao-Yuan Yang and Moto Hira and Zhaoheng Ni and Anjali Chourdia and Artyom Astafurov and Caroline Chen and Ching-Feng Yeh and Christian Puhrsch and David Pollack and Dmitriy Genzel and Donny Greenberg and Edward Z. Yang and Jason Lian and Jay Mahadeokar and Jeff Hwang and Ji Chen and Peter Goldsborough and Prabhat Roy and Sean Narenthiran and Shinji Watanabe and Soumith Chintala and Vincent Quenneville-Bélair and Yangyang Shi},
  journal={arXiv preprint arXiv:2110.15018},

Disclaimer on Datasets

This is a utility library that downloads and prepares public datasets. We do not host or distribute these datasets, vouch for their quality or fairness, or claim that you have license to use the dataset. It is your responsibility to determine whether you have permission to use the dataset under the dataset's license.

If you're a dataset owner and wish to update any part of it (description, citation, etc.), or do not want your dataset to be included in this library, please get in touch through a GitHub issue. Thanks for your contribution to the ML community!

Open Source Agenda is not affiliated with "Audio" Project. README Source: pytorch/audio
Open Issues
Last Commit
4 days ago

Open Source Agenda Badge

Open Source Agenda Rating