Making Music With Ruby
We're sorry, but this discussion has just been closed to further replies.
Tags:
OK, so what I would recommend is that you basically plagiarize eval_style.rb and db_drum_definition.rb.
eval_style (plus all the stuff in lib) gets a loop going where a file is perpetually re-evaluated. db_drum_definition.rb is that file.
Arx is really kind of a beast these days, due to edits I made right before Burning Man to enable some new features. It doesn't really have a nice user-friendly API for this sort of thing. However, I would basically do what you're asking for with a db_drum_definition-style file-reloader, like this:
@notes = []
def convert(word)
word.each_byte do |byte|
@notes << Note.new(:channel => 1, note_number => word -5, :duration => 0.25)
end
end
text = %(blah blah blah)
text.each {|word| convert(word)}
@notes
This is just pseudocode, but it'd probably work. The magic happens with @notes - the file to eval is expected to return an array of notes, which is to say Arx Note objects.
© 2009 Created by Giles on Ning. Create a Ning Network!