smelt.cs.princeton.edu has some nice examples for handling this kind of stuff... dt On Apr 17, 2009, at 2:45 PM, Kassen wrote:
Hans;
The methods are similar, but the cause different: Scala needs a lot of MIDI channels for the microtonality (and by default uses all but one). So when playing on the layout I gave, one uses several different channels (or so is my impression).
Ah, I get it. In this case though we are dealing with input from the computer keyboard which we send internally to a set of voices in ChucK so we aren't limited by MIDI's rather out-dated concepts.
What we do need is some way to translate key numbers to pitches. I'd do that with a simple array of floats mapping key-numbers to pitches. I'd likely deal with pitchbend using some sort of scaling on those values, if I needed pitchbend, that could then get rid of any issues arising from non-equal spacing between notes.
To clarify; what is interesting about the polyphonic examples in the MIDI dir is how they deal with polyphony, not the MIDI as such.
From your other mail;
It strikes me that Chuck may not be good for mixing key numbers with the translated "AsCII" numbers. Ir seems one has to make choice of what to use. When mixing, one may want to pick up the event first and looking at both the key and the (eventual) Unicode number.
Well, both methods can be used in a single set of keyboard parsing rules though that would mean that we'd need to make sure we0re not mixing up all the numbers that will be flying around. We might, for example, look at the key number only when there is no character associated with the key that was pressed, for example. Many other strategies are possible.
ChucK may be build on decades of knowledge about sound and computation but sadly we are also stuck with decades of legacy and semi-standards that occasionally make our life more annoying than it would ideally be. Personally I hate writing tens if not hundreds of lines parsing the keyboard because it's so boring and there are so many nearly random numbers yet it all needs to be exactly right. I'm terribly sorry but I don't think there is anything I can do for you there aside from showing understanding.
Yours, Kas. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users