Best use of Wiimote accelerometer data to control video playback

whorl's icon

Hi all,

I'm trying to control video playback with some wii nunchuks but am having problems controlling the data streams from the accelerometers.

I want to measure the overall change in the accelerometer to control the speed of the video. In other words, the faster the viewer moves their hands, the faster the video will play.

The acc. data goes from 0.0 to 1.0 but the problem is that it is at 0.5 at a rest state (no movement). If the viewer waves their arms around (for example), the data will shoot up and down (above and below 0.5). Does anyone know a good way to harness that overall change and channel it into a data stream from 0.0 (no movement) to 1.0 (most movement)?

In this way it wouldn't matter if the movement was up/down/left/right, as any movement would be registered as a displacement and could be used to speed up the video.

Here is the rough and ready patch i've been working on using OSCulator to get the wiimote data (jitter not connected). Ideally I would combine multiple data streams from different accelerometers and use the overall movement from the average of them all.

Max Patch
Copy patch and select New From Clipboard in Max.

Any help is so much appreciated!

terenceformer's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Hey Whorl,
Here's something that might help. It could probably use some better maths, but I think the general idea is a good starting point. I don't have my wiimote with me at the moment so I can't test it unfortunately. Hope it helps! :D

whorl's icon

Hi TERENCEFORMER,
Thanks a lot for the patch man. It's a big help. I like the "p averaging" and "p scaling" sub-patches a lot.
Still wondering how i'm going to get a fluid control of video with jittery wii data. It might be fine with graphics or abstract shapes, but I suspect if I use it to control the playback speed of video it will be too confusing. I might try using the wii data to send a bang, in turn gradually speeding up the video momentarily. Hmmmm.

Thanks!

terenceformer's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I took another stab at it. The result is something that should do precisely what you want :)
• the data is scaled to the correct range, 0-1
• data is averaged over an adjustable number of values, reducing jitter
• motion is calculated as a single 3D acceleration vector (movement can be in any direction)
• a vizzie example demonstrates how "amount of motion" can control rate of playback
The wiimote has some peculiarities.. I tried to account for one (with a calibration system), but the others shouldn't be too much of a problem (e.g. rotating the wiimote affects the /accel/xyz values, so you may need to tweak things to account for that).

whorl's icon

Whoa, that seems to be about it! Thanks a lot!

Giampaolo Costagliola's icon

Hi WHorl, TerrenceFormer. HOpe you are both doing great.

I foud this thread by googling "vectorize accelerometer" I jus saw this installation by Maotik called Omnis, it consist of an almos 360 degree screen that sorrounds the audience, and spacialized sound, particle systems quite cool.

But at some point on the performance this beatboxer guy gets in the middle of the screen circle and starts beatboxing, hes got mic on one hand, and glove with an acceleromter on the other hand. With the glove he gestures towards the screen and things pop up on the screen on/near where he pointed the gesture at.

Im thinking, the algorithm is combining XYZ from the accelerometer into a single 3D vector and measuring until this reaches a treshold no?

but the hand keeps softly flip flaping, so the accelerometer might be upside down or sideways at the time the treshold is reached, so, do you have an idea of how to make this vector from a fixed reference point? i mean, in order to know in which direction the acelerometer is accelerating, but not in reference to itself but in reference to the space it is in.

Does the question have any sense?

cheers!

Ryleigh Wilson's icon

I'm trying to do something similar but instead of movement from a nunchuck, I'm looking at trying to use movement from a camera (though the use of a cv.jit module). I'm trying to get the video speed to respond to how fast people are moving through a space. This patch was helpful but I'm having a hard time figure out how to adjust it so I can use it with my idea. Any help would so greatly appreciated!!

Thanks!!