[chuck-users] get midi channel associated with midi event

Spencer Salazar ssalazar at princeton.edu
Sun Jul 23 00:38:19 EDT 2006


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 at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users



More information about the chuck-users mailing list