Project

sound

0.0
No commit activity in last 3 years
No release in over 3 years
Allows for effiecent cross-platform sound libraries in pure Ruby by tapping into native libraries.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 3.0.0, ~> 3.0

Runtime

= 1.3.1
 Project Readme

sound

Gem Version Build Status Coverage Status Dependency Status Code Climate

This Gem is still in alpha! Breaking and changes are expected everywhere!

Cross Platform sound libraries for the Ruby developer

gem install sound

And then in irb or some script:

require 'sound'
device = Sound::Device.new
format = Sound::Format.new
data = Sound::Data.new(format)
data.generate_sine_wave(440, 500, 1)
device.write data
device.close

This will work on both windows and linux. However Linux platforms will need to install the libasound and libasound-dev packages. You may already have these installed.

With some sensible defaults, the previous example can be written in one line:

Sound::Device.new {|d| d.write Sound::Data.new.sine_wave(440, 500, 1)}

More can be seen in examples/example.rb

The three main parts of this gem are Sound::Device, Sound::Format, Sound::Data. That way more platforms can be added easily by interacting with DeviceLibrary. Obviously the only Data object that can be made is a sine wave (albeit two different ways), but that will grow into more data types like midi sequences and data pulled from audio files. As for Format, well that will just be PCM or MIDI for now, but that may evolve too.

Come back for more features in the future including more data types (loading from files, other wave types), more platforms (MacOS is next on the list) and new formats (midi).