OPUS-Ruby is a Ruby Gem for working with the OPUS Audio Codec. OPUS-Ruby uses the Ruby-FFI extension to wrap the native OPUS library code. This means that you must have OPUS installed in order for this gem to work.
Add this line to your application's Gemfile:
gem 'opus-ruby'
And then execute:
$ bundle
Or install it yourself as:
$ gem install opus-ruby
# Create new encoder with a sample rate of 48 kHz, a frame size of 480 bytes and 1 channel
encoder = Opus::Encoder.new 48000, 480, 1
# Set the bitrate to 32 kbit/s
encoder.bitrate = 32000
# Set the VBR rate to 0 (CBR)
encoder.vbr_rate = 0
# Encode some raw audio
encoded = encoder.encode(raw_audio, 960)
# Safely destroy encoder
encoder.destroy
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request