Using and Smoothing Accelerometer data in MaxMSP

Twice's icon

Hi all,

I'm currently working on a patch to convert accelerometer data into usable 'number' data to apply to a synth patch in Max. My knowledge of Max isn't great, so i'm seeking some help on how to smooth the numbers and convert it to be usable with with the typical midi range of 127.
The data is coming from an arduino device, and at the moment ranges from -15,000 to +15,000, it isn't a steady number and tends to flux around 100 either way (+ & -).
I'm looking for some advice on suitable objects/methods to convert the large numbers to small ones which I can then use to map. I have some idea of how to smooth these numbers fluxes from there but any suggestions would be much appreciated!

Many thanks,

J

yaniki's icon

Try objects such as [line] (for "smoothing" data stream ) and [scale] (to convert values between ranges).

Holland Hopson's icon

Try averaging the input or running it through a low-pass filter. The [slide] object can be handy for this. I use [zl.stream] and [mean] for easy averaging. You can adjust the number of values output by zl.stream to change the sensitivity.

Twice's icon

I've had a play with median, ill see what mean is all about!
Is there any chance you could throw me together a quick example? I've not thought about using a low pass filter for dealing with numbers before...

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

the more you smooth the data the more latency you introduce, but median is probably the best overall approach :

Rodrigo's icon
brendan mccloskey's icon

It's been a while since Chris Muir popped up here, anyone remember this from several years ago?

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

Brendan