Tap tempo algorithm

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Hi,

Can anyone suggest a good algorithm for calculating tempo from taps?

Currently I'm using a moving average of the last 8 taps, start calculating on the 3rd and reset after 3 seconds of nothing. It works ok, but a little unwieldy. I've tried adjusting the number of taps used but not been able to find something that responds both quickly and accurately for a wide range of tempos.

I've be thinking of using the last N _seconds_ worth of taps, rather than the last N taps, but suspect that would behave very differently with different tempos.

Any other suggestions?

Brad

Post

Line 6 use the last two taps only. If you tap more than twice you are just resetting the tempo with each successive tap. I've always found their tap tempo to work just fine. No need to complicate the works when the basic approach will do.

Post

-do an average of all previous taps, so that the precision keeps improving over time

-when the time between 2 taps is so much different from the average, reset it, as it probably means a new tempo is being tapped

-indicate when the user has tapped enough times (I use 12) & the estimation starts to be reliable enough


I've always found their tap tempo to work just fine.
except that humans aren't robots and that it's very hard to tap twice at the same speed
DOLPH WILL PWNZ0R J00r LAWZ!!!!

Post

> except that humans aren't robots and that it's very hard to tap twice at the same speed.

It is actually impossible to not tap twice at the same tempo. If you only tap twice you are guaranteed that it was the same tempo since tapping once is no tempo at all and the tempo is defined as the time between taps. The problem with the averaging method is due to a human's lack robotic tendencies the taps become more accurate over time. The last two taps in any stream is just as likely to be the most accurate for the tempo you were going for as taking any other approach. And all other approaches are just as likely to make it harder to tap your tempo as your first few taps at the wrong tempo will now have a permanent affect on the average for the rest of the taps. Kind of like an IIR for taps.

Also consider the case that a human tapper will often not have the tempo clearly in their head and will start tapping either slower or faster than they intend. Over a number of taps they finesse their tapping tempo back toward the tempo they actually seek.

Take the last two taps and you're just as likely to get the right tempo as if you try complex averaging interpolation schemes. Also you'll make it a lot easier on people using your plugin who now don't have to always tap a certain number of times. By taking the last two taps you allow your users to tap any number of times that suits them personally and still come up with the tempo they wanted.

Post

Take the last two taps and you're just as likely to get the right tempo as if you try complex averaging interpolation schemes.
but that doesn't work.. in practice.. and it's very easy to test (if you think that statistics are bullshit)

You have a stream of data (time between taps), you have an error (human error), there's no reason for that average error to change over time. So what anyone intelligent would do? Average, and the error will disappear.

as your first few taps at the wrong tempo will now have a permanent affect on the average for the rest of the taps
There's just no reason for the first taps error to be different from the last taps. The idea is not to tap several times to improve over time, but to get more samples to get rid of the error.
DOLPH WILL PWNZ0R J00r LAWZ!!!!

Post

> The idea is not to tap several times to improve over time, but to get more samples to get rid of the error.


And also prevent advanced use scenarios like allowing your customer to tap through a gradually changing tempo to keep everything in sync without having to first build a tempo map of freeform audio. A situation I've used (and advised others to use) that becomes impossible if you are averaging. The averaging approach can work in some subset of situations but you are making a basic assumption about how your product can and should be used and disallowing anything outside of your initial interpretation of its application. If you are making a tool that is specifically supposed to let you tap it over some period of time then it tells you what tempo you were most likely tapping at then averaging probably really is the best method. If you are making a tap function within an effect that is supposed to modify the effect in realtime as you tap it (by varying a parameter for instance) then averaging might get you more accuracy in certain situations but it will also restrict the use of that feature.

This is merely personal opinion, because I demand flexibility from my tools.

Post

Use a weighted averaging method, where the youngest taps have the greatest weight.
"Until you spread your wings, you'll have no idea how far you can walk." Image

Post

Thanks everyone.

Some interesting insight there. Sounds like there's a lot of personal preference. Perhaps a setting to control the responsiveness is in order.

Post Reply

Return to “DSP and Plugin Development”