[chuck-users] sending midi program change

Scott Wheeler wheeler at kde.org
Fri Jan 5 13:44:29 EST 2007


Bruce Murphy wrote:
> You or others might find the midi stuff at 
>   

As kind of a tangent, I also started writing a MIDI wrapper, though mine 
was more concerned with handling incoming events (and thusfar only does 
note-on and note-off).  Mine's more OO style, though since ChucK only 
lets you export one class per file, I've been doing way too much copying 
and pasting it into stuff.

A basic example of how to use it is something like:

fun void noteOnHandler(MidiHandler handler)
{
    while(true)
    {
        handler.noteOn => now;
        <<< "Note On  - Pitch: ", handler.noteOn.pitch, " Velocity: ", 
handler.noteOn.velocity >>>;
    }
}

MidiHandler handler;

spork ~ noteOnHandler(handler);

// do other stuff

Sending a note-on is then:

NoteOnEvent on;
1 => on.pitch;
handler.send(on);

This would be a bit cleaner if ChucK had constructors -- something like 
handler.send(NoteOnEvent(1, 127));

-Scott
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: MidiHandler.ck
Url: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20070105/3b2ebbda/attachment.bat 


More information about the chuck-users mailing list