acceleration Maths? from 'not-quite' n00b

brendan mccloskey's icon

Hallo Board
I've designed a grain-synth, using an FSR/touchpad interface. I have mapped the touchpad X-axis to buffer-playback position (grain sample-location), such that motion across this axis 'reads' through the buffer file. It would be cool if I could cross-couple this modality with grain-pitch, by extracting acceleration data from the touchpad (using Max objects, natch). The only 'delta' -type object I can find is [mousestate], which works really well, giving increasing values the faster the cursor moves, and, more importantly, generating a zero when at rest. Oh, I just thought, isn't there an Max object called [mean]? But, would this give false readings, in the case where high position values changed slowly, I'd still get a high acceleration value, or low position values changed quickly giving low values. Hmmm. I'll go and check [mean].
Brendan
edit- I'm not using [mousestate], I'm using Arduino to [serial]..

Jesse's icon
Max Patch
Copy patch and select New From Clipboard in Max.
Holland Hopson's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Here's my favorite velocity/acceleration abstraction. It's another way to do just what Jesse posted, only with an added stage to calculate acceleration given velocity.

brendan mccloskey's icon

Thanks everyone
here's an equally elegant solution from timlloyd
https://cycling74.com/forums/work-out-the-rate-of-change-or-similar-accelerometer-data

Brendan

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

Does it mean that the faster I am drawing on the LCD object (see below), the higher the values will output ? (and so the higher the dial will rise ?)

I am looking forward a similar thing (or maybe it is exactly this one but I am not sure). I would like Max to output low values when I am drawing slowly and high values when I am drawing faster. But can we make it without a return to 0 on the dial object ?

Mayou's icon

I mean for example :

- very slow moves keep the values near 10 on the dial
- slow moves keep the values near 30 on the dial
...
...
- fast moves keep the values near 100
- very fast moves keep the values near 120-127

(I ask the question for the LCD object, but in fact I would like to make it work on sensors too (accelerometers or magnetometers or both), which is not the same problem since the LCD drawing traduces a sort of speed instead of the sensor values reception which works at a 25 Hz reception rate for example. Damn it is hard to translate a slow movement into a little number and a faster movement into a bigger one with accelerometers).

Thanks,

Mathieu

Mayou's icon

Ok in fact I would like to output my movements velocity/speed (I have the 3 axis accelerometers values).

(But I am having trouble calculating the acceleration norm and then the precise velocity (m.s-2) to make a slider move correctly.)

Any ideas ?

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

Hi Mayou
I'm trying to implement the same idea, and I added to timlloyd's patch to generate a 'running average' (without using [mean], [peak] or [trough] objects) of the acceleration values; I don't think it's very elegant, perhaps someone else can implement those objects I mentioned to generate a more stable running average.

The problem with this example is that it cannot account for changes in acceleration during motion, unless acceleration returns to zero first. Damn I wish I'd paid more attention in Maths class.

Mayou's icon

I am currently trying to find a good way to get the velocity in the main referential when we have the 3 axis acceleration with a sensor. I think it is a good solution to our problem but I still have some difficulties.