From: Ryan Pavlik Date: 2003-09-29T05:43:31+09:00 Subject: Re: Thoughts on yield On Sun, 28 Sep 2003 17:31:23 +0900 "daz" wrote: > Like Jim, my feeling is that some parsing will be > required. There's no C# method in Ruby. > > Allows for sharps, flats and naturals. There are however unary +, -, and ~ operators, which might translate appropriately. However there are a lot of intricacies to music in general, and I'm not sure any of the given methods quite handle them all. Some everyday things to think about: * Tuples * Multiple voices (not just simple chords) * Note length tweaks (for slurs and the like) * Rests (big one) * Tempo changes * Dynamics Arrays might help some things, as well as combining voices on the fly, but it may not be as straightforward as desired. Hmm, a little method_missing magic and we could have a vaguely track-like view perhaps: part { bar 16 # Set each _ to be a 16th, so ____ is 1/4 v1 a____, r_, ... v2 r_, b__, +c__, ... # r is for rest v1 ... v2 ... } In this case, you could chop off the _'s and count them in method_missing to produce a length, call the method with that as a parameter, returning a Note modified by the current key signature, and then the +/-/~ would take over. Each vN function would be a "voice" function that was later collected and combined by part(), so you could handle multiple voice movement without a lot of crazy arrays and stuff. Of course, you'd likely still want to allow [a_, +c_, e_] to give you a chord in a particular voice for convenience. Anyhow, just a thought, still a number of issues to be dealt with I'm sure. -- Ryan Pavlik "It's at the expense of some of my favorite organs, but it's worth it." - 8BT