low overhead interpolation trick
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. Yours, Kas.
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).
I've been thinking of making one of these: http://www.societyofrobots.com/sensors_mercury_switch.shtml hth, ------- -.- 1/f ))) --. ------- ... http://www.algomantra.com
I have one of those tilt-sensing joysticks... honestly, they're
pretty bad. I've had a lot more luck building out my own hardware
with an arduino and a proper accelerometer. it's a tad more pricey
than the cheap joysticks, but you have the added benefit of reusing
the parts to build all kinds of interfaces to chuck. I also have some
Python code that reads from the serial bus and sends out OSC messages
to chuck (or anything, really). Plus hardware hacking is so fun...
I've been trying to get around to releasing some code and
instructions, but school has been getting the better of me. Let me
know if you want me to share the Python hack.
http://arduino.cc
http://www.sparkfun.com/commerce/advanced_search_result.php?keywords=accelerometer&x=0&y=0
cheers,
mike
On Fri, Apr 11, 2008 at 10:00 PM, AlgoMantra
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).
I've been thinking of making one of these:
http://www.societyofrobots.com/sensors_mercury_switch.shtml
hth, ------- -.- 1/f ))) --. ------- ... http://www.algomantra.com _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On 12/04/2008, mike clemow
I have one of those tilt-sensing joysticks... honestly, they're pretty bad. I've had a lot more luck building out my own hardware with an arduino and a proper accelerometer. it's a tad more pricey than the cheap joysticks, but you have the added benefit of reusing the parts to build all kinds of interfaces to chuck. I also have some Python code that reads from the serial bus and sends out OSC messages to chuck (or anything, really). Plus hardware hacking is so fun...
Yeah, the "real" ones are much better and the Arduino is appealing. I'll probably get into it later this year, I can get a Arduino through the group-discount of a friend of mine who's studying arts&technology so that's too good to pass up. I hope we'll get a serial interface in ChucK anyway because I want to use it to add leds to my sequencing joystick. Still, there are reasons for using ready-made joypads. I'm 30 and like many in my generation I grew up gaming, starting with the Nintendo 8bit and never saw a reason to give it up. So; I'm very familiar with joypads and being intimately familiar with the exact layout of your instrument is a huge advantage. I mean... if you look at how many hours a concert musician has to spend with his instrument, then compare that to how many hours many of us have spend with joypads&sticks.... It also means I can confidently promise my band-mate I'll have my "lead-joypad" instrument done in less then a week, there's something to be said for that. :¬). I may get back to you on your generous offer but for now I'm quite happy with my little interpolation optimisation trick. Last night I found that optimisation in this stuff can make a huge difference; for example the joy-fm example that comes with ChucK draws a LOT of cpu when you start moving the sticks a lot. HID can generate a lot of data once you get into moving the axis about and optimisation means the buffer and so the latency can go down. That's a big deal to me. Also; Algromanta; if I were you I'd just buy a ready-made sensor. They are expensive as far as sensors go but here it would save a lot of time. Yours, Kas.
participants (3)
-
AlgoMantra
-
Kassen
-
mike clemow