Skip to content

ankane/torchaudio-ruby

Repository files navigation

TorchAudio Ruby

🔥 An audio library for Torch.rb

Build Status

Installation

First, install SoX. For Homebrew, use:

brew install sox

Add this line to your application’s Gemfile:

gem "torchaudio"

Getting Started

This library follows the Python API. Many methods and options are missing at the moment. PRs welcome!

Tutorial

Download the audio file and install the matplotlib gem first.

Basics

Load a file

waveform, sample_rate = TorchAudio.load("file.wav")

Save a file

TorchAudio.save("new.wave", waveform, sample_rate)

Transforms

TorchAudio::Transforms::Spectrogram.new.call(waveform)

Supported transforms are:

  • AmplitudeToDB
  • ComputeDeltas
  • Fade
  • MelScale
  • MelSpectrogram
  • MFCC
  • MuLawDecoding
  • MuLawEncoding
  • Spectrogram
  • Vol

Functional

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

Datasets

Load a dataset

TorchAudio::Datasets::YESNO.new(".", download: true)

Supported datasets are:

Disclaimer

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.

SoX Installation

Mac

brew install sox

Windows

todo

Ubuntu

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

Travis CI

Add to .travis.yml:

addons:
  apt:
    packages:
      - sox
      - libsox-dev
      - libsox-fmt-all

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

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

About

An audio library for Torch.rb

Resources

License

Stars

Watchers

Forks

Packages

No packages published