• ### Trigger Bang from change in sign of acceleration

I'm attempting to build a patch which triggers a sound when a change in direction of acceleration occur. I hope to use Kinect with Synapse to track the movement of my hand (lets say just on y-axis). I want to trigger a bang when my hand changes sign of acceleration from a downward velocity to an upward velocity (mimicking a drumstick striking a drum for example).
My current thought process is to set a very quick metro (1ms) and detect change in y-axis position. for example..
y_change = y(t) - y(t+1)...
If the hand is moving downward, y_change will be a negative value.. If the hand begins to move upward y_change becomes a positive value! Essentially, I want to trigger a bang whenever the y_change value goes from negative to positive.
I am wondering if this train-of-thought is the right way to approach the task or if there are better options?
Also, the drawback with this approach is, I would like to quantify the speed at which the sign of velocity occurs, with high velocity corresponding to loud.. Low velocity corresponding to soft. Any ideas? My worry is this begins to incorporate Physical Modelling aspects which significantly increases the complexity of the project.

Thanks in advance for any suggestions/help!

• | Posts 5 | Views 8114
• hello,
something like this would trigger a bang whenever an incoming value changes from negative to positive (but not the other way..):
negative-positive.pd

to quantify speed i would consider using
[i]
[change]
[t b b]
[timer]
maby tweek the incoming values with multiplication/division

hope that helps!

• @solipp
Thanks for your help..

I've managed to get the equation working based on when the velocity exceeds a certain value. A bang sends when the velocity goes over a certain value.
My issue now is that, it bangs multiple times when the slider (stick) is going downward as the velocity stays above the specified value for multiple metro bangs, hence banging the sound sample multiple times,

I reckon I need to find a way to obtain acceleration values as opposed to velocity, your code for triggering when going from negative to plus would work perfectly then!!
But I haven't found much nor can I get my head around differentiating the velocity value to obtain an acceleration value.
Thanks

• @mark.o.s If you are using extended it is easy using [delta]....... and [change].....
or do you need a vanilla solution?
acceleration.pd
David.

• I would say, [delta] is the way to go.
Depending on which is your input, position or velocity, you can use it twice in a row, or just once.
Then if the result raises above or falls below zero you have a change in the direction of acceleration.
As pointed out by @whale-av, using change you will overcome the issue of multiple triggering.

If you're not on extended, you can just take this patch (which you will find in extended) and will work on Vanilla.

Good luck

| Posts 5 | Views 8114
Internal error.

Oops! Looks like something went wrong!