get midi channel associated with midi event
Hi How can one tell which midi channel is associated with a midi-event? It's probably somewhere in the docs, although I wasn't able to find it... -- peace, love & harmony Atte http://www.atte.dk | quartet: http://www.anagrammer.dk http://www.atte.dk/gps | compositions: http://www.atte.dk/compositions
Howdy! Under the MIDI spec, MIDI messages carry the channel in the lower 4 bits of the first byte of the message. Thus the following code would store the channel in the "channel" variable: msg.data1 & 0x0f => int channel; spencer On Jul 20, 2006, at 7:44 AM, Atte André Jensen wrote:
Hi
How can one tell which midi channel is associated with a midi-event? It's probably somewhere in the docs, although I wasn't able to find it...
-- peace, love & harmony Atte
http://www.atte.dk | quartet: http://www.anagrammer.dk http://www.atte.dk/gps | compositions: http://www.atte.dk/ compositions _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Here's the best MIDI spec I've come across:
http://www.borg.com/~jglatt/tech/midispec.htm
On 7/20/06, Spencer Salazar
Howdy! Under the MIDI spec, MIDI messages carry the channel in the lower 4 bits of the first byte of the message. Thus the following code would store the channel in the "channel" variable:
msg.data1 & 0x0f => int channel;
spencer
On Jul 20, 2006, at 7:44 AM, Atte André Jensen wrote:
Hi
How can one tell which midi channel is associated with a midi-event? It's probably somewhere in the docs, although I wasn't able to find it...
-- peace, love & harmony Atte
http://www.atte.dk | quartet: http://www.anagrammer.dk http://www.atte.dk/gps | compositions: http://www.atte.dk/ compositions _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Spencer Salazar wrote:
Under the MIDI spec, MIDI messages carry the channel in the lower 4 bits of the first byte of the message. Thus the following code would store the channel in the "channel" variable:
msg.data1 & 0x0f => int channel;
Thanks! -- peace, love & harmony Atte http://www.atte.dk | quartet: http://www.anagrammer.dk http://www.atte.dk/gps | compositions: http://www.atte.dk/compositions
Spencer Salazar wrote:
Thus the following code would store the channel in the "channel" variable:
msg.data1 & 0x0f => int channel;
Ok, I've worked a bit with it, and in all my ignorance I don't know how to correctly handle the remaining part of the data1-part. I tried: midi_msg.data1 &0xf0 - 128 => type this gives me: "noteon" => types[16]; "controller" => types[48]; "bender" => types[96]; But looking at http://www.borg.com/~jglatt/tech/midispec/messages.htm I see noteon should be 8, controller 11 and pitchwheel and bender 14, right? How do I correctly and safely extract those types from the data1-part? -- peace, love & harmony Atte http://www.atte.dk | quartet: http://www.anagrammer.dk http://www.atte.dk/gps | compositions: http://www.atte.dk/compositions
Howdy, On Jul 22, 2006, at 6:40 PM, Atte André Jensen wrote:
Spencer Salazar wrote:
Thus the following code would store the channel in the "channel" variable:
msg.data1 & 0x0f => int channel;
Ok, I've worked a bit with it, and in all my ignorance I don't know how to correctly handle the remaining part of the data1-part. I tried:
midi_msg.data1 &0xf0 - 128 => type
To get the high word, you should actually be right-shifting by 4: ( ( msg.data1 & 0xf0 ) >> 4 ) => type; That should get you the correct results. spencer
this gives me: "noteon" => types[16]; "controller" => types[48]; "bender" => types[96];
But looking at http://www.borg.com/~jglatt/tech/midispec/ messages.htm I see noteon should be 8, controller 11 and pitchwheel and bender 14, right? How do I correctly and safely extract those types from the data1-part?
-- peace, love & harmony Atte
http://www.atte.dk | quartet: http://www.anagrammer.dk http://www.atte.dk/gps | compositions: http://www.atte.dk/ compositions _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On Sun, Jul 23, 2006 at 12:38:19AM -0400, Spencer Salazar wrote:
Howdy,
midi_msg.data1 &0xf0 - 128 => type
To get the high word, you should actually be right-shifting by 4:
( ( msg.data1 & 0xf0 ) >> 4 ) => type;
That be a high nybble, incidentally. B> -- Packrat (BSc/BE;COSO;Wombat Implementor) Nihil illegitemi carbovndvm
participants (4)
-
Atte André Jensen
-
Bruce Murphy
-
Justin Sante
-
Spencer Salazar