Tap tempo algorithm
-
- KVRian
- 791 posts since 8 Mar, 2006 from Australia
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
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
-
- KVRist
- 150 posts since 25 Jan, 2008 from Oregon, USA
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.
-
tony tony chopper tony tony chopper https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=3103
- KVRAF
- 3561 posts since 20 Jun, 2002
-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
-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
except that humans aren't robots and that it's very hard to tap twice at the same speedI've always found their tap tempo to work just fine.
DOLPH WILL PWNZ0R J00r LAWZ!!!!
-
- KVRist
- 150 posts since 25 Jan, 2008 from Oregon, USA
> 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.
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.
-
tony tony chopper tony tony chopper https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=3103
- KVRAF
- 3561 posts since 20 Jun, 2002
but that doesn't work.. in practice.. and it's very easy to test (if you think that statistics are bullshit)Take the last two taps and you're just as likely to get the right tempo as if you try complex averaging interpolation schemes.
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.
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.as your first few taps at the wrong tempo will now have a permanent affect on the average for the rest of the taps
DOLPH WILL PWNZ0R J00r LAWZ!!!!
-
- KVRist
- 150 posts since 25 Jan, 2008 from Oregon, USA
> 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.
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.
-
- KVRAF
- 1940 posts since 16 Aug, 2004 from Vienna, Austria
-
- KVRian
- Topic Starter
- 791 posts since 8 Mar, 2006 from Australia
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.
Some interesting insight there. Sounds like there's a lot of personal preference. Perhaps a setting to control the responsiveness is in order.
