Method: Musiki::Makam#sample

Defined in:
lib/musiki.rb

#sample(dur = 500) ⇒ Object



251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/musiki.rb', line 251

def sample dur=500
  # TODO seems there's an error with the frequencies, doesn't sound right.
  puts "#{self.inspect}:" if self.up or self.down
  if self.up
    print "> "
    self.up.notes.each_with_index do |note,index|
      print "#{index == 0 ? note.name.tr_capitalize : note.name}#{index < self.notes.length - 1 ? ", " : "."}"
      `chuck --bufsize64 ../misc/makam.ck:#{Musiki::base}:#{dur}:#{note.order} 2>&1 >/dev/null`
    end
    puts
  end
  if self.down
    print "< "
    self.down.notes.each_with_index do |note,index|
      print "#{index == 0 ? note.name.tr_capitalize : note.name}#{index < self.down.notes.length - 1 ? ", " : "."}"
      `chuck --bufsize64 ../misc/makam.ck:#{Musiki::base}:#{dur}:#{note.order} 2>&1 >/dev/null`
    end
    puts
  end
end