Giter Site home page Giter Site logo

hopingz / torchaudio Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pytorch/audio

0.0 0.0 0.0 1.49 GB

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

License: BSD 2-Clause "Simplified" License

Shell 1.80% C++ 16.20% Python 78.36% Cuda 1.22% CMake 1.48% Batchfile 0.77% Dockerfile 0.18%

torchaudio's Introduction

torchaudio: an audio library for PyTorch

Build Status Documentation Anaconda Badge Anaconda-Server Badge

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.

Dependencies

  • 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.12.0 0.12.0 >=3.7, <=3.10
LTS 1.8.2 0.8.2 >=3.6, <=3.9
Previous versions
torch torchaudio python
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.2 0.8.2 >=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

Installation

Binary Distributions

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

Please refer to https://pytorch.org/get-started/locally/ 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 LTS versions are distributed through a different channel than the other versioned releases. Please refer to the above page for details.

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 setup.py install

# OSX
CC=clang CXX=clang++ python setup.py 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:
#   https://docs.microsoft.com/en-us/cpp/build/how-to-enable-a-64-bit-visual-cpp-toolset-on-the-command-line?view=msvc-160#use-vcvarsallbat-to-set-a-64-bit-hosted-build-architecture
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 && set BUILD_SOX=0 && python setup.py install
# or
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" && set BUILD_SOX=0 && python setup.py 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
torchaudio.save('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
torchaudio.save('foo_save.wav', waveform, sample_rate)  # save tensor to file, as usual

Note

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

API Reference

API Reference is located here: http://pytorch.org/audio/main/

Contributing Guidelines

Please refer to CONTRIBUTING.md

Citation

If you find this package useful, please cite as:

@article{yang2021torchaudio,
  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},
  year={2021}
}

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!

torchaudio's People

Contributors

mthrok avatar vincentqb avatar nateanl avatar jamarshon avatar hwangjeff avatar yangarbiter avatar ezyang avatar soumith avatar krishnakalyan3 avatar dhpollack avatar bhargavkathivarapu avatar malfet avatar tomassosorio avatar atalman avatar seemethere avatar jimchen90 avatar yoyololicon avatar azizcode92 avatar nicolashug avatar engineerchuan avatar mattip avatar prabhat00155 avatar jcaw avatar mszhanyi avatar jdsgomes avatar peterjc123 avatar harishsdev avatar cpuhrsch avatar goldsborough avatar bigfootjon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.