## Tap Tempo

Nov 2, 2006 at 5:35pm

# Tap Tempo

Im having trouble trying to create an accurate tap tempo patch in max. does anyone have any ideas that could help me?

#28490
Nov 2, 2006 at 6:58pm

On Nov 2, 2006, at 12:36 PM, Dave Mcwayne wrote:

> Im having trouble trying to create an accurate tap tempo patch in
> max. does anyone have any ideas that could help me?

[timer]
It’s right in the help patch.

—–
Nathan Wolek
nw@nathanwolek.com

http://www.nathanwolek.com

#87514
Nov 2, 2006 at 7:02pm

so i can use that to create a crude tap tempo, but how about taking an average over say, ten seconds to create a more accurate tempo reading?

#87515
Nov 2, 2006 at 7:56pm

just apply some math to the output…
use the trough and peak objects to
find the min and max, then average them

#87516
Nov 2, 2006 at 8:45pm

#87517
Nov 2, 2006 at 10:28pm

Dave Mcwayne skrev:
> so i can use that to create a crude tap tempo, but how about taking an average over say, ten seconds to create a more accurate tempo reading?
here’s the one I use. It averages all taps that are below an adjustable
threshold.
Andreas.

#P window setfont “Sans Serif” 9.;
#P flonum 309 215 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 310 366 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 160 391 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 160 367 80 9109513 expr 60000. / \$f1;
#P comment 261 367 46 9109513 Average:;
#P comment 440 35 129 9109513 Do not count if longer than…;
#P comment 469 160 33 9109513 Reset;
#P number 300 283 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 348 213 27 9109513 < ;
#P newex 348 249 27 9109513 gate;
#P newex 324 99 41 9109513 togedge;
#P newex 365 33 71 9109513 loadmess 2000;
#P number 365 55 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 324 77 27 9109513 >;
#P number 353 366 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 331 335 32 9109513 mean;
#B color 5;
#P number 397 283 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 460 302 28 9109513 clear;
#P button 460 131 21 0;
#P message 439 213 14 9109513 0;
#P newex 325 167 43 9109513 timer;
#B color 5;
#P button 397 126 31 0;
#N counter;
#X flags 0 0;
#P newobj 397 249 66 9109513 counter;
#P newex 331 302 27 9109513 gate;
#P comment 409 160 26 9109513 Tap!;
#P comment 235 214 70 9109513 Your latest tap:;
#P window linecount 6;
#P comment 470 218 210 9109513 If the time between two taps is longer
than the time set by the loadmess , then the [mean] automatically
clears , in the assumption that you have started a new tempo. Not the
most advanced logic to use , but it works in my rig , at least.;
#P window linecount 1;
#P comment 389 366 164 9109513 Number of taps averaged (accuracy);
#P comment 129 391 29 9109513 bpm:;
#P connect 13 0 25 0;
#P connect 25 0 26 0;
#P connect 19 0 21 0;
#P connect 8 0 28 0;
#P connect 13 0 27 0;
#P fasten 8 0 15 0 330 190 310 190 310 74 329 74;
#P connect 15 0 18 0;
#P fasten 7 0 8 0 402 160 330 160;
#P connect 6 0 5 0;
#P connect 5 0 13 0;
#P fasten 11 0 13 0 465 328 336 328;
#P fasten 16 0 15 1 370 73 346 73;
#P lcolor 10;
#P fasten 8 0 20 0 330 190 353 190;
#P connect 20 0 19 0;
#P connect 19 0 5 1;
#P connect 13 1 14 0;
#P fasten 7 0 8 1 402 160 363 160;
#P connect 17 0 16 0;
#P connect 16 0 20 1;
#P lcolor 10;
#P connect 28 0 19 1;
#P fasten 7 0 6 0 402 230 402 230;
#P connect 6 0 12 0;
#P fasten 10 0 9 0 465 204 444 204;
#P connect 9 0 6 3;
#P fasten 18 0 10 0 329 123 465 123;
#P connect 10 0 11 0;
#P window clipboard copycount 29;

#87518
Mar 3, 2007 at 2:16pm

This one is simple. It measures time between taps, sums them up, and then divides by number of taps. That way you always have accurate average.
Plus some extra’s

Greets, Daan

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 493 595 41 196617 r start;
#P flonum 493 668 57 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 493 618 40 196617 60000;
#P newex 493 646 27 196617 / 0.;
#P outlet 493 716 15 0;
#P newex 348 645 103 196617 accum;
#B color 5;
#P number 348 667 43 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 356 607 24 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 356 625 35 196617 set \$1;
#P newex 313 607 41 196617 r start;
#P newex 218 496 37 196617 r stop;
#P newex 587 146 37 196617 s stop;
#P comment 533 51 100 196617 stop output;
#P inlet 540 76 15 0;
#P newex 540 146 42 196617 s reset;
#P button 540 98 41 0;
#P newex 220 519 32 196617 r tap;
#P outlet 348 715 15 0;
#P outlet 262 715 15 0;
#P inlet 379 79 15 0;
#P message 191 544 14 196617 1;
#P message 229 542 14 196617 0;
#P newex 169 519 41 196617 r start;
#P newex 379 149 41 196617 s start;
#P button 379 101 41 0;
#P inlet 213 79 15 0;
#P toggle 209 566 15 0;
#P number 291 565 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 269 458 15 0;
#P number 291 518 64 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 270 411 14 196617 0;
#P newex 375 458 32 196617 r tap;
#P newex 257 153 32 196617 s tap;
#P newex 413 458 42 196617 r reset;
#P newex 149 199 42 196617 r reset;
#P newex 149 176 42 196617 s reset;
#P button 413 481 15 0;
#P number 375 525 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 375 481 15 0;
#N counter;
#X flags 0 0;
#P newobj 375 502 66 196617 counter;
#P button 269 497 15 0;
#P newex 269 477 43 196617 delay 3;
#P newex 291 541 27 196617 /;
#P number 219 370 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 270 433 85 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 219 395 27 196617 +;
#P button 262 652 44 0;
#P newex 264 592 37 196617 metro;
#P button 219 312 15 0;
#P button 244 312 15 0;
#P message 200 236 14 196617 1;
#P message 149 240 14 196617 0;
#P user gswitch2 200 257 39 32 0 0;
#P button 197 312 15 0;
#P button 149 220 15 0;
#P newex 149 154 61 196617 delay 3000;
#P newex 219 337 35 196617 timer;
#P button 213 102 41 0;
#P window linecount 3;
#P comment 41 156 100 196617 reset after 3 seconds of not tapping;
#P window linecount 2;
#P comment 331 563 100 196617 average ms between all taps;
#P window linecount 1;
#P comment 185 52 100 196617 input1: tap tempo;
#P comment 365 51 100 196617 input2: start output;
#P window linecount 2;
#P comment 224 746 100 196617 output1: bangs in time;
#P comment 346 745 100 196617 output2: average tap time in ms;
#P comment 472 745 100 196617 output3: average tempo in BPM;
#P connect 49 0 53 0;
#P connect 49 0 50 0;
#P connect 51 0 49 0;
#P connect 37 0 17 1;
#P connect 37 0 57 0;
#P connect 37 0 61 1;
#P connect 63 0 60 0;
#P connect 61 0 63 0;
#P connect 62 0 61 0;
#P connect 64 0 62 0;
#P connect 31 0 28 0;
#P connect 28 0 25 2;
#P connect 40 0 41 0;
#P connect 45 0 40 0;
#P connect 25 0 27 0;
#P connect 26 0 25 0;
#P connect 33 0 26 0;
#P connect 57 0 56 0;
#P connect 58 0 47 0;
#P connect 59 0 58 0;
#P connect 55 0 59 0;
#P connect 56 0 59 0;
#P connect 27 0 22 1;
#P connect 22 0 37 0;
#P connect 35 0 22 0;
#P connect 24 0 35 0;
#P connect 20 0 19 1;
#P connect 20 0 36 0;
#P connect 20 0 35 0;
#P connect 19 0 20 0;
#P connect 34 0 20 0;
#P connect 11 0 8 0;
#P connect 11 0 34 0;
#P connect 23 0 24 0;
#P connect 36 0 23 0;
#P connect 38 0 17 0;
#P connect 18 0 46 0;
#P connect 17 0 18 0;
#P connect 7 0 9 0;
#P connect 7 0 14 0;
#P connect 7 0 12 1;
#P connect 7 0 32 0;
#P connect 15 0 8 1;
#P connect 12 1 16 0;
#P connect 12 1 15 0;
#P connect 48 0 43 0;
#P connect 54 0 43 0;
#P connect 21 0 19 0;
#P connect 8 0 21 0;
#P connect 16 0 8 0;
#P connect 39 0 7 0;
#P connect 43 0 38 0;
#P connect 44 0 38 0;
#P connect 14 0 12 0;
#P connect 13 0 12 0;
#P connect 12 0 11 0;
#P connect 42 0 44 0;
#P connect 10 0 13 0;
#P connect 30 0 10 0;
#P connect 9 0 29 0;
#P window clipboard copycount 65;

#87519
Mar 3, 2007 at 4:13pm

thats a lot of numbers, don malone!

#87520
Mar 5, 2007 at 10:32am

Daniel van West wrote:
> This one is simple. It measures time between taps, sums them up, and
> then divides by number of taps. That way you always have accurate
> average.

Its only simple if the tempo is relatively constant. Averaging is always
very off for accelerando or ritardando…

I haven’t seen a good patch for that yet by the way, looks I have to
start implementing it…

Stefan

Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#87521
Mar 5, 2007 at 9:20pm

>I haven’t seen a good patch for that yet by the way,
>looks I have to start implementing it…

Does this get you somewhere?

_
johan

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P comment 243 66 79 196617 arrow keys;
#P comment 341 264 55 196617 tempo;
#P message 42 225 61 196617 60 127 90;
#P message 90 140 20 196617 10;
#P newex 42 288 43 196617 noteout;
#P newex 42 260 52 196617 makenote;
#P newex 42 201 32 196617 sel 1;
#P button 309 184 15 0;
#P noclick;
#P user radiogroup 228 255 18 16;
#X size 1;
#X offset 16;
#X inactive 0;
#X itemtype 0;
#X flagmode 0;
#X set 1;
#X done;
#P noclick;
#P flonum 281 210 75 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 197 143 15 0;
#P flonum 263 262 75 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 233 231 27 196617 ==;
#P newex 272 232 54 196617 !/ 60000.;
#P message 117 143 33 196617 1000;
#P newex 116 106 45 196617 loadbang;
#P message 158 143 20 196617 25;
#P newex 214 81 105 196617 sel 123 124 125 126;
#P newex 199 44 40 196617 key;
#P newex 191 119 35 196617 active;
#N vpatcher 254 194 646 666;
#P outlet 208 358 15 0;
#P inlet 141 37 15 0;
#P outlet 168 358 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 118 192 27 196617 f;
#N comlet smear factor;
#P inlet 162 36 15 0;
#P toggle 133 324 15 0;
#P noclick;
#N comlet to button;
#P outlet 133 358 15 0;
#P newex 52 53 27 196617 t i i;
#N comlet bang means now;
#P inlet 86 36 15 0;
#P newex 52 169 31 196617 sel 1;
#N comlet status;
#P inlet 52 36 15 0;
#P newex 69 72 27 196617 gate;
#N vpatcher 67 191 668 745;
#P window setfont “Sans Serif” 9.;
#P comment 128 248 84 196617 ?alle volgende ||;
#P newex 196 283 27 196617 t f f;
#P newex 196 110 29 196617 t i i;
#P newex 196 148 29 196617 pack;
#P newex 196 167 68 196617 route 0 1;
#P newex 196 129 45 196617 >= 2000;
#P newex 231 110 29 196617 * 2.;
#P comment 148 397 249 196617 t>2000: reset (first measured number is new tempo);
#P comment 148 383 115 196617 t=200-2000: measured;
#P inlet 276 93 15 0;
#P newex 221 234 27 196617 t i i;
#P newex 196 189 27 196617 t 1 i;
#P newex 225 189 40 196617 t 2 b i;
#P newex 196 215 35 196617 gate 2;
#P window linecount 1;
#N vpatcher 20 74 297 257;
#N comlet set to value;
#P inlet 167 29 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 97 46 124 196617 expr pow(1.037\,\$i1)-1;
#N comlet f out;
#P outlet 27 106 15 0;
#N comlet cut-off;
#P inlet 97 29 15 0;
#N comlet i or f in;
#P inlet 27 29 15 0;
#P newex 27 87 27 196617 t f f;
#P newex 27 68 151 196617 expr ((\$f2*\$f3)+\$f1)/(\$f2+1);
#P connect 2 0 0 0;
#P connect 0 0 1 0;
#P connect 1 0 4 0;
#P connect 3 0 5 0;
#P connect 5 0 0 1;
#P connect 6 0 0 2;
#P fasten 1 1 0 2 49 106 180 106 180 65 172 65;
#P pop;
#P newobj 196 264 43 196617 p flowp;
#P outlet 213 302 15 0;
#P outlet 240 208 15 0;
#P inlet 260 93 15 0;
#P inlet 196 93 15 0;
#P window linecount 0;
#P comment 177 341 154 196617 smoothened last n numbers;
#P comment 148 369 100 196617 t<200: ignored;
#P comment 248 129 140 196617 is groter dan 2x tijdsduur??;
#P comment 281 191 140 196617 ?dan beshouwen als herstart;
#P comment 352 206 14 196617 ?;
#P comment 249 236 184 196617 eerst gemeten waarde na herstart en?;
#P connect 6 0 22 0;
#P connect 22 0 19 0;
#P connect 19 0 21 0;
#P connect 21 0 20 0;
#P connect 20 0 13 0;
#P connect 13 0 11 0;
#P fasten 12 0 11 0 230 210 201 210;
#P connect 11 0 10 0;
#P connect 14 0 10 0;
#P connect 10 0 23 0;
#P fasten 15 0 10 1 281 259 217 259;
#P connect 23 1 9 0;
#P connect 22 1 21 1;
#P connect 13 1 11 1;
#P connect 11 1 14 0;
#P connect 20 1 12 0;
#P fasten 7 0 12 0 265 186 230 186;
#P connect 14 1 10 2;
#P fasten 23 0 18 0 201 321 357 321 357 76 236 76;
#P fasten 12 2 18 0 260 211 357 211 357 76 236 76;
#P connect 18 0 19 1;
#P connect 12 1 8 0;
#P pop;
#P newobj 118 170 55 196617 p method2;
#P newex 148 290 21 196617 t 0;
#P newex 118 211 61 196617 t b f f;
#P newex 118 148 78 196617 split 150 2000;
#P newex 69 129 59 196617 split 0 200;
#P newex 69 91 60 196617 t b b b;
#P newex 69 110 35 196617 timer;
#P newex 148 271 43 196617 del 150;
#P newex 118 252 40 196617 t b 1 b;
#P newex 118 233 35 196617 metro;
#P connect 11 0 14 0;
#P connect 14 0 12 0;
#P connect 14 1 10 0;
#P connect 10 0 4 0;
#P connect 4 0 3 0;
#P connect 3 0 5 0;
#P connect 13 0 10 1;
#P connect 4 1 3 1;
#P connect 5 1 6 0;
#P connect 6 0 9 0;
#P fasten 12 0 18 0 57 189 123 189;
#P connect 9 0 18 0;
#P connect 20 0 18 0;
#P connect 18 0 7 0;
#P fasten 9 1 0 0 168 230 123 230;
#P connect 12 1 0 0;
#P connect 7 0 0 0;
#P connect 0 0 1 0;
#P connect 8 0 16 0;
#P connect 1 1 16 0;
#P connect 16 0 15 0;
#P fasten 6 1 9 1 191 167 145 167;
#P connect 7 1 0 1;
#P connect 1 2 2 0;
#P connect 2 0 8 0;
#P connect 17 0 9 2;
#P connect 7 2 19 0;
#P connect 4 2 21 0;
#P pop;
#P newobj 233 181 53 196617 p tempo;
#P comment 216 145 55 196617 on/off;
#P comment 357 212 28 196617 ?t;
#P connect 2 2 15 0;
#P connect 2 1 9 0;
#P connect 2 1 13 0;
#P connect 6 0 2 3;
#P connect 9 0 11 0;
#P connect 8 0 2 2;
#P connect 5 3 2 1;
#P connect 5 1 2 1;
#P connect 5 2 2 1;
#P connect 5 0 2 1;
#P connect 2 0 16 0;
#P connect 2 0 10 0;
#P connect 12 0 2 0;
#P connect 10 0 14 0;
#P connect 4 1 5 0;
#P connect 3 0 12 0;
#P connect 7 0 6 0;
#P connect 7 0 8 0;
#P connect 7 0 19 0;
#P connect 19 0 18 2;
#P connect 17 1 18 1;
#P connect 17 0 18 0;
#P connect 20 0 17 0;
#P connect 16 0 20 0;
#P window clipboard copycount 23;

#87522
Mar 6, 2007 at 7:41pm

Median rather than mean might be a good algorithm for this, as outliers
will be less influential. Here’s PM.ListMedian. (use bucket, zl
group, etc. to construct your list)

max v2;
#N vpatcher 10 59 410 344;
#P outlet 58 243 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 4;
#P comment 269 75 99 196617 For an even number of items , average the
two middle terms.;
#P window linecount 1;
#P newex 18 76 50 196617 t l l;
#N vpatcher 20 74 323 357;
#P window setfont “Sans Serif” 9.;
#P newex 177 96 27 196617 int;
#P newex 81 179 34 196617 * 0.5;
#P newex 81 148 27 196617 + 0.;
#P newex 153 121 34 196617 zl nth;
#P newex 177 73 34 196617 * 0.5;
#P outlet 81 205 15 0;
#P newex 81 119 34 196617 zl nth;
#P inlet 81 41 15 0;
#P newex 105 74 34 196617 * 0.5;
#P newex 105 96 27 196617 + 1;
#P inlet 105 41 15 0;
#P comment 23 41 55 196617 From Sort;
#P comment 123 43 58 196617 List Length;
#P connect 5 0 6 0;
#P connect 6 0 10 0;
#P connect 10 0 11 0;
#P connect 11 0 7 0;
#P connect 9 0 10 1;
#P connect 2 0 4 0;
#P connect 4 0 3 0;
#P connect 3 0 6 1;
#P connect 5 0 9 0;
#P connect 2 0 8 0;
#P connect 8 0 12 0;
#P connect 12 0 9 1;
#P pop;
#P newobj 176 210 71 196617 p EVEN_LISTS;
#N vpatcher 20 74 243 280;
#P outlet 81 154 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 81 119 34 196617 zl nth;
#P inlet 81 41 15 0;
#P newex 105 89 34 196617 * 0.5;
#P newex 105 66 27 196617 + 1;
#P inlet 105 41 15 0;
#P comment 23 41 55 196617 From Sort;
#P comment 123 43 58 196617 List Length;
#P connect 5 0 6 0;
#P connect 6 0 7 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 6 1;
#P pop;
#P newobj 58 212 65 196617 p ODD_LISTS;
#N vpatcher 20 74 148 278;
#P outlet 22 144 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 22 110 27 196617 + 1;
#P newex 22 85 30 196617 == 0;
#P newex 22 57 27 196617 % 2;
#P inlet 22 29 15 0;
#P connect 0 0 1 0;
#P connect 1 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P pop;
#P newobj 58 157 81 196617 p EVEN_OR_ODD;
#P newex 58 187 128 196617 gate 2;
#P newex 58 133 33 196617 zl len;
#P newex 18 103 68 196617 mxj list.Sort;
#P inlet 18 41 15 0;
#P comment 115 68 121 196617 Finds the median of a list;
#P window setfont “Sans Serif” 18.;
#P comment 114 34 99 196626 PM.Median;
#P window setfont “Sans Serif” 9.;
#P window linecount 3;
#P comment 268 34 100 196617 For an odd number of items , use the
middle term.;
#P connect 3 0 10 0;
#P connect 10 0 4 0;
#P connect 10 1 5 0;
#P connect 5 0 7 0;
#P connect 7 0 6 0;
#P connect 6 0 8 0;
#P fasten 9 0 12 0 181 235 63 235;
#P connect 8 0 12 0;
#P hidden connect 5 0 8 1;
#P fasten 4 0 6 1 23 181 181 181;
#P connect 6 1 9 0;
#P hidden connect 5 0 9 1;
#P pop;

On Mar 5, 2007, at 5:32 AM, Stefan Tiedje wrote:

> Daniel van West wrote:
>> This one is simple. It measures time between taps, sums them up, and
>> then divides by number of taps. That way you always have accurate
>> average.
>
> Its only simple if the tempo is relatively constant. Averaging is
> always very off for accelerando or ritardando…
>
> I haven’t seen a good patch for that yet by the way, looks I have to
> start implementing it…
>
> Stefan
>
> —
> Stefan Tiedje————x——-
> –_____———–|————–
> –(_|_ —-|—–|—–()——-
> — _|_)—-|—–()————–
> ———-()——–www.ccmix.com
>
>
>
http://www.petermcculloch.com

#87523
Mar 7, 2007 at 10:54pm

jvkr schrieb:
>> I haven’t seen a good patch for that yet by the way,
>> looks I have to start implementing it…
>
> Does this get you somewhere?

at least accelerando it seems to do, the ritardando is obviously more
tricky…

Stefan

Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#87524
Mar 8, 2007 at 12:59am

man this topic is old, care to dig through the 2001 list entries and reply to something about “Jitter coming soon”?

#87525

You must be logged in to reply to this topic.