/audio

simple audio I/O for pytorch

Primary LanguageCBSD 2-Clause "Simplified" LicenseBSD-2-Clause

Load Audio files directly into PyTorch Tensors

Audio library for PyTorch

  • Support audio I/O (Load files)

Load the following formats into a torch Tensor

  • mp3, wav, aac, ogg, flac, avr, cdda, cvs/vms,
  • aiff, au, amr, mp2, mp4, ac3, avi, wmv,
  • mpeg, ircam and any other format supported by libsox.

Dependencies

  • libsox v14.3.2 or above

Quick install on OSX (Homebrew):

brew install sox

Linux (Ubuntu):

sudo apt-get install sox libsox-dev libsox-fmt-all

Installation

python setup.py install

Quick Usage

import torchaudio
sound, sample_rate = torchaudio.load('foo.mp3')

API Reference

torchaudio.load

loads an audio file into a Tensor
audio.load(
	string,  # path to file
	out=None, # optionally pass output Tensor (any CPU Tensor type)
)