Read & write .wav sound files with Ruby
Let’s say you have these three Wave files:
The program below will concatenate them into one file:
Intrigued? Check out more examples.
Or, check out the tutorial for a guide to getting started.
First, install the WaveFile gem from rubygems.org:
gem install wavefile
…and include it in your Ruby program:
require "wavefile"
…or Gemfile:
gem "wavefile"
The WaveFile gem requires Ruby 2.0 or greater.
Note: It’s recommended that you use a Ruby version manager such as rbenv. But if using the system Ruby that comes pre-installed on macOS, you should used sudo gem install wavefile
. Otherwise you might run into a file permission error.
View the source on GitHub
Copyright © Joel Strait 2009-23