Unverified Commit adb3d3da authored by Vincent QB's avatar Vincent QB Committed by GitHub
Browse files

backend change instructions in readme (#553)

* backend change instructions in readme.

* link to installation instructions.
parent 9835db75
...@@ -13,7 +13,7 @@ having all the computations be through Pytorch operations which makes it easy ...@@ -13,7 +13,7 @@ having all the computations be through Pytorch operations which makes it easy
to use and feel like a natural extension. to use and feel like a natural extension.
- [Support audio I/O (Load files, Save files)](http://pytorch.org/audio/) - [Support audio I/O (Load files, Save files)](http://pytorch.org/audio/)
- Load the following formats into a torch Tensor using sox - Load the following formats into a torch Tensor using SoX
- mp3, wav, aac, ogg, flac, avr, cdda, cvs/vms, - mp3, wav, aac, ogg, flac, avr, cdda, cvs/vms,
- aiff, au, amr, mp2, mp4, ac3, avi, wmv, - aiff, au, amr, mp2, mp4, ac3, avi, wmv,
- mpeg, ircam and any other format supported by libsox. - mpeg, ircam and any other format supported by libsox.
...@@ -98,10 +98,29 @@ Quick Usage ...@@ -98,10 +98,29 @@ Quick Usage
```python ```python
import torchaudio import torchaudio
waveform, sample_rate = torchaudio.load('foo.mp3') # load tensor from file
torchaudio.save('foo_save.mp3', waveform, sample_rate) # save tensor to file 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](https://pysoundfile.readthedocs.io/en/latest/)
using the following. See [SoundFile](https://pysoundfile.readthedocs.io/en/latest/)
for installation instructions.
```python
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
```
Unlike SoX, SoundFile does not currently support mp3.
API Reference API Reference
------------- -------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment