I have a question regarding accelerometer and sound playback. I have an application which plays a sound when the device is shaken, it plays an mp3 sample which I made, but I want to find a way to be able to increase the intensity of the sound as the device is shaking " harder ". This would require, in my opinion, more than one sample assosicated with it. If you are familiar with the concept of " velocity " you probably know what I mean: when you hit a key harder for example on a midi controller which plays back your sound, not only the volume increases but also other qualities of the sound itself, for example its content in harmonics. Therefore,I would like to know how to achieve this result. Thank you in advance.
As Robert has commented, you can simply look at the change in acceleration (dA/dt = jerk) over a short period of time and if you see a lot of zero-crossings, or large differences, you can assume someone is shaking the device. Now depending on the intensity of this shake you will see larger values in a derivative, indicating how hard the user is shaking.
I however would be careful when this is implemented because what if the user is not shaking the device, we may not want their volume to set to 0, but that can be solved with some simple thresholding.