[chuck] Example code for MIDI interfacing with ChucK

Ge Wang gewang at CS.Princeton.EDU
Wed Jan 19 10:23:18 EST 2005

On Jan 19, 2005, at 9:23 AM, Ajay Kapur wrote:

> some example code for using headgear (as requested earlier)
> and the esitar on the ChucK site:
> http://wiki.cs.princeton.edu/index.php/ChucK_Programs

Thanks, Ajay!  I also put up the 3rd file that you sent - E-Sitar
+ 8 robotic turntables (interesting).

The framework posted should be generic enough to handle pretty
much any MIDI device - the headgear skeleton code simply catches
messages from the 2 axis accelerometer - the data ranges in the
innermost if statements are hard-coded to match the output of the
microcontroller that's reading the accelerometers.  Other parts of
the program specific to the E-Sitar mapping have been replaced by:

     // replace the following with useful code...
     //    - change ugen parameter(s),
     //    - connect / disconnect ugens
     //    - spork a shred,
     //    - or machine.add() a new program on the on-the-fly
     //    - something else
     chout => "type: " => type => " data1: " => data1 => " data2: " =>  
data2 => endl;

It might not be much help to Jerry's headtracker, at least until we put
mouse / serial support into ChucK (they are on the list).  But for now,
it illustrates one way to handle real-time input by polling.  The code
could be further simplified once there are arrays, events, and switch

> the page at http://hct.ece.ubc.ca/nime/2005/chuck.html lists the date  
> as May 25th, 2004.

This has been corrected to May 25th, 2005.  Thanks, Jerry, for catching  


More information about the chuck mailing list