Forums > MaxMSP

Best use of Wiimote accelerometer data to control video playback

June 17, 2013 | 10:44 pm

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.

Any help is so much appreciated!

<code>

– Pasted Max Patch, click to expand. –

</code>


June 18, 2013 | 1:06 am

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

<code>

– Pasted Max Patch, click to expand. –

</code>


June 18, 2013 | 2:30 am

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!


June 19, 2013 | 1:20 am

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).

<code>

– Pasted Max Patch, click to expand. –

</code>


June 19, 2013 | 6:43 pm

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


Viewing 5 posts - 1 through 5 (of 5 total)