[chuck-users] low overhead interpolation trick

Kassen signal.automatique at gmail.com
Fri Apr 11 19:21:40 EDT 2008

Dear ChucKists.

I was running out of fingers and buttons on my joypad... who-ever decided
the thumbs should share both the analogue sticks and the buttons on the top?
Anyway, I picked up a tilt-sensing joypad. Sadly proper tilt sensors are
relatively expensive and games devices typically get made as cheaply as
possible (grumble).

To cut a long story short; it sends a fury of values that are somewhere
around the value that it needs to be. Result; the poll-rate gets to be a
kind of noisy harmonic. So; this leads to the question of how to interpolate
this mess without making complex function calls at this high poll-rate and
cook the poor CPU before we get any sound made at all.

Solution; as soon as I get the value the axis moved to I write that to a
Step Ugen's ".next()". Then;

Step my_axis => LPF my_interpolation => blackhole;

//set to taste, it's latency v.s. noise
//maybe a rate that's relatively prime to the poll-rate would be best?
5 => my_interpolation.freq;

then my_interpolation.last() can be polled at whatever rate makes sense. It
can also be chucked directly to Ugens like oscillators set to act as a FM
synth (use the filter's gain to scale) or to Gain's set to multiply.

Very cheap and so far quite pleasant to work with, I thought I'd share.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20080412/73cf0a44/attachment.htm 

More information about the chuck-users mailing list