RAFL – Ruby Audio File Library January 17, 2010Posted by Aaron in Audio, Programming.
My Ruby programming brainchild has finally been birthed out into the world. I’ve created a Git repository (after some head scratching), so hopefully people out in the world will be able to put it to use, and possibly improve upon it.
I hereby introduce:
RAFL is an entirely native Ruby library that allows for reading and writing of WAV files (in its current incarnation). I hope to one day expand it to support other formats. As demonstrated with RAFLcopter.rb (see what I did there?), it is capable of doing the following:
When reading a WAV file:
- Determine Bit Depth, Sample Rate, and Number of Channels (supports surround sound)
- Calculate Peak and RMS values
- Translate sample values into dbFS
When writing a WAV file:
- Write any number of channels at any sample rate
- Generate white noise, pink noise and sine waves at any amplitude or frequency
With simple modification of the sample code it is possible to interleave separate audio files into one, etc. It’s currently fairly flexible, and will be more so once I code up a mixer of sorts. The current most major limitation is that it doesn’t support anything about 16-bit audio…it’s one of those things that I’ve been meaning to fix for a long time. RAFL now supports 24-bit audio!
Anyhoo…co developers are welcome if anyone would like to help take it to the next level or put it to use in another project.