[chuck-users] kbpiano

Stephen Sinclair radarsat1 at gmail.com
Sat Aug 4 15:02:04 EDT 2007


I've been making a few Chuck synths lately and have been wanting a way
to play them straight from the keyboard instead of having to attach a
MIDI device.  I used to do this all the time with FastTracker back in
the DOS-ages.

Anyways, of course Chuck can get keyboard input, so all that was
missing was a mapping from the keyboard keys to MIDI note numbers.

Attached is a Chuck script that reads the keyboard and then generates
Events containing a note number.  These are available through a public
class, so a separate Chuck script can wait for the events and spork

Note that it's not quite an up-to-scratch implementation of polyphony,
since there is only a single event structure that will get overwritten
by the next key press.  Maybe I'll work on that next... (perhaps using
an array to store extra notes, but some timing calculations will need
to be made..)

Oh yes, and this is designed for a US keyboard, but feel free to
change the keymap.  I figured it out from the kb.ck output.

So anyways, enjoy. :)

ps., run concurrently:
$ chuck kbpiano.ck kbpiano_example.ck

-------------- next part --------------
A non-text attachment was scrubbed...
Name: kbpiano.ck
Type: application/octet-stream
Size: 2868 bytes
Desc: not available
Url : http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20070804/2f22d6b2/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kbpiano_example.ck
Type: application/octet-stream
Size: 619 bytes
Desc: not available
Url : http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20070804/2f22d6b2/attachment-0001.obj 

More information about the chuck-users mailing list