🔥 An audio library for Torch.rb
First, install SoX. For Homebrew, use:
brew install sox
Add this line to your application’s Gemfile:
gem "torchaudio"
This library follows the Python API. Many methods and options are missing at the moment. PRs welcome!
Download the audio file and install the matplotlib gem first.
Load a file
waveform, sample_rate = TorchAudio.load("file.wav")
Save a file
TorchAudio.save("new.wave", waveform, sample_rate)
TorchAudio::Transforms::Spectrogram.new.call(waveform)
Supported transforms are:
- AmplitudeToDB
- ComputeDeltas
- Fade
- MelScale
- MelSpectrogram
- MFCC
- MuLawDecoding
- MuLawEncoding
- Spectrogram
- Vol
TorchAudio::Functional.lowpass_biquad(waveform, sample_rate, cutoff_freq)
Supported functions are:
- amplitude_to_DB
- compute_deltas
- create_dct
- create_fb_matrix
- DB_to_amplitude
- dither
- gain
- highpass_biquad
- lowpass_biquad
- mu_law_decoding
- mu_law_encoding
- spectrogram
Load a dataset
TorchAudio::Datasets::YESNO.new(".", download: true)
Supported datasets are:
This library downloads and prepares public datasets. We don’t host any datasets. Be sure to adhere to the license for each dataset.
If you’re a dataset owner and wish to update any details or remove it from this project, let us know.
brew install sox
todo
sudo apt install sox libsox-dev libsox-fmt-all
Add to .travis.yml
:
addons:
apt:
packages:
- sox
- libsox-dev
- libsox-fmt-all
View the changelog
Everyone is encouraged to help improve this project. Here are a few ways you can help:
- Report bugs
- Fix bugs and submit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features
To get started with development:
git clone https://github.com/ankane/torchaudio-ruby.git
cd torchaudio-ruby
bundle install
bundle exec rake compile
bundle exec rake test