[chuck-users] Hello and a cool snippet (crash)

Martin Ahnelöv operagasten at gmail.com
Sun Jul 22 19:02:24 EDT 2007

Hello there!

I've been playing a little with ChucK for the past few days and I'm
really enjoying it. After finally figuring out how to modulate a
sinosc's frequency (that one really needs documentation!), I though I
were ready for som Hid action. It were actually much easier to set it up
than I thought - but still a bit harder than I would like (probably due
to the lack of documentation).

Well, I successfully miss-used the program and got a couple of different
crashes (woo!). I think the following is cool.

// Patch 
SinOsc s => Gain g => dac;
SinOsc lfo => blackhole;

1.0 => lfo.freq;
300 => lfo.gain;

0.4 => g.gain;

// which mouse
0 => int device;

// hid objects
Hid hi;
HidMsg msg;

// try
if( !hi.openMouse( device ) ) me.exit();
<<< "mouse '",hi.name(), "' ready...", "" >>>;

while(true) {
    hi => now;
    while(hi.recv(msg)&&msg.isMouseMotion()) {
        lfo.last() * (msg.deltaX-msg.deltaY) => s.freq; //rubbie!

Try changing the msg.deltaX-msg.deltaY to msg.deltaX*msg.deltaY or
msg.deltaX/msg.deltaY for the crashes. Bug? This might be

By the way, isn't msg.deltaX and Y pretty inconsistent from the rest of
the API? shouldn't it be msg.deltaX()?

Well, Thanks for a great tool!



More information about the chuck-users mailing list