Method: RubyAudio::Sound#initialize

Defined in:
lib/ruby-audio/sound.rb

#initialize(path, mode = 'r', info = nil) ⇒ Sound

Creates a new Sound object for the audio file at the given path. Mode defaults to "r", but valid modes are "r", "w", and "rw".

When creating a new sound, a valid SoundInfo object must be passed in, as libsndfile uses it to determine the output format.

info = RubyAudio::SoundInfo.new :channels => 1, :samplerate => 48000, :format => RubyAudio::FORMAT_WAV|RubyAudio::FORMAT_PCM_16
snd = RubyAudio::Sound.new "new.wav", 'r', info


33
34
35
36
# File 'lib/ruby-audio/sound.rb', line 33

def initialize(path, mode='r', info=nil)
  info ||= SoundInfo.new
  super(path, mode, info)
end