Closed ghost closed 1 year ago
in the midi protocol, the channel is encoded as the lower nibble (4 bits) of the status (first) byte of channel mode messages.
In practical terms, just use a bit-wise OR (|
) to combine the status byte with the (zero-based) channel number.
in the midi protocol, the channel is encoded as the lower nibble (4 bits) of the status (first) byte of channel mode messages.
In practical terms, just use a bit-wise OR (
|
) to combine the status byte with the (zero-based) channel number.
Thank you for your fast answer! I already read on channel in midi spec. Why would you use bit-wise or instead of adding/subtracting to the second byte of note_on/off messages?
And since you labeled this thread correctly as q question I would ask another question just here: could you point me to an example for playing multiple simultaneous voices through different channels? I would appreciate it very much!
Addition is also fine. Just remember that the channel is zero based and has to be <= 15.
Polyphony is just a matter of sending multiple note on events (possibly with different channels) one after another, and their respective note offs at a later time. The hard part is scheduling the sending of these messages at the right times. You can look at the sequencer
example in the repo for one possible way to do that.
I would be very glad If someone would help me understand the concept of channels. In the following (from examples directory):
How could I send a note to different channels? I.e. why can't I use channel numbers in the note_on list to sepcify the channel?