module MusicTheory::Output
Public Instance Methods
buffer_format()
click to toggle source
# File lib/music_theory/output.rb, line 12 def buffer_format WaveFile::Format.new :mono, :float, sample_rate end
format()
click to toggle source
# File lib/music_theory/output.rb, line 8 def format WaveFile::Format.new :mono, :pcm_16, sample_rate end
output_track()
click to toggle source
# File lib/music_theory/output.rb, line 16 def output_track WaveFile::Writer.new "#{output_file_name || 'music'}.wav", format do |writer| buffer = WaveFile::Buffer.new samples, buffer_format writer.write buffer end end
play()
click to toggle source
# File lib/music_theory/output.rb, line 23 def play output_track unless File.file?("#{output_file_name || 'music'}.wav") `mplayer #{output_file_name}.wav &> /dev/null` nil end
sample_rate()
click to toggle source
# File lib/music_theory/output.rb, line 4 def sample_rate 22050 end