[chuck-users] utility code for sending MIDI messages

Michael Heuer heuermh at gmail.com
Mon Mar 19 12:21:22 EDT 2012


Kassen wrote:
> Michael Heuer wrote:
>> Lucas Zawacki wrote:
>>
>> > I think this hidden gem was mentioned by Kassen somewhere and I've
>> > used it ever since to manipulate MIDI:
>> > http://www.rattus.net/~packrat/audio/ChucK/
>>
>> Ah yes, thanks Lucas, just found this on the ChucK wiki.  Is the
>> author Bruce on the mailing list?
>
> He used to be, at least, that's how I first heard about this, I think.
> People develop and intrests change; I'm not sure he still is on the
> list.

Maybe someone else can help explain this part to me then?  I'm not
good at bit-twidding.

((command & 0xf) << 4) | ((channel - 1) & 0xf) => midimessage.data1;
command | channel => command;
byte1 & 0x7f  => midimessage.data2;
byte2 & 0x7f => midimessage.data3;
midiport.send(midimessage);

Why is the ... => command; line there?  Isn't that dead code?

The bitwise and value for data2 and data3 (0x7f) is not the same I see
in this java midi library (0xff)

https://github.com/heuermh/rwmidi/blob/2d73ac726f5000c85dd7aa3eb160872acb60af3a/src/rwmidi/MidiEvent.java#L65

Thanks,

   michael


More information about the chuck-users mailing list