I'm attempting to use the ruby-alsa gem to provide audio playback on the server. Unfortunately, I keep getting an uninitialized constant MyClass::Playback exception when attempting to do so.
I'm very new to Ruby and Rails, so I'm not sure how to resolve this issue. The following has been added to my Gemfile and I have run a bundle install:
gem 'ruby-alsa'
My controller code looks like this (though I can't even begin to guarantee the validity of the code):
# Test audio playback
file = File.open("sample.wav")
#ALSA::PCM::Playback.open do |playback| # This line is commented out because it didn't work
Playback.open do |playback|
playback.write do |length|
file.read length
end
end
file.close
Update: If I uncomment the following line, I get the same exception (except ALSA is the uninitialized constant):
ALSA::PCM::Playback.open do |playback|