#N canvas 643 50 803 811 10;
#X obj 214 160 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X floatatom 355 176 5 0 0 0 - - -, f 5;
#N canvas 285 555 292 294 mstobpm 0;
#X obj 45 13 inlet;
#X obj 46 145 timer;
#X obj 47 238 outlet;
#X obj 46 172 expr 60000 / $f1;
#X obj 46 108 t b b;
#X obj 45 78 sel 0;
#X text 97 55 time 16th notes;
#X obj 43 45 % 24;
#X obj 48 206 / 1;
#X connect 0 0 7 0;
#X connect 1 0 3 0;
#X connect 3 0 8 0;
#X connect 4 0 1 0;
#X connect 4 1 1 1;
#X connect 5 0 4 0;
#X connect 7 0 5 0;
#X connect 8 0 2 0;
#X restore 122 548 pd mstobpm;
#X floatatom 122 587 5 0 0 0 - - -, f 5;
#N canvas 947 274 174 209 dialinbpm 0;
#X obj 29 41 inlet;
#X obj 29 72 expr 1000/($f1/60);
#X floatatom 29 121 5 0 0 0 - - -, f 5;
#X obj 29 96 / 24;
#X obj 30 150 outlet;
#X connect 0 0 1 0;
#X connect 1 0 3 0;
#X connect 2 0 4 0;
#X connect 3 0 2 0;
#X restore 298 223 pd dialinbpm;
#N canvas 158 50 902 691 mainmetro 1;
#X obj 254 49 inlet;
#X obj 443 49 inlet;
#X obj 280 156 metro 50;
#X obj 389 438 + 1, f 5;
#X obj 280 462 f;
#X floatatom 280 581 5 0 0 0 - - -, f 5;
#X obj 280 607 outlet;
#X msg 565 496 0;
#X obj 350 484 >= 23;
#X obj 350 516 sel 1;
#X obj 408 145 midirealtimein;
#X obj 280 387 spigot 1;
#X obj 408 388 spigot 0;
#X obj 423 300 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 333 323 ==;
#X obj 333 349 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
#X obj 461 350 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 408 167 sel 248 250 251;
#X obj 580 243 delay 1000;
#X msg 423 241 1;
#X obj 408 190 t b b b b, f 25;
#X msg 580 218 stop;
#X msg 580 267 0;
#X text 67 12 autoswitch between internal and MIDI clock;
#X text 525 144 MIDI 248 = clock \; 250 = start \; 251 = continue.
;
#X obj 562 362 s midi-clock-present;
#X obj 325 207 loadbang;
#X msg 325 229 0;
#X obj 266 90 t f b;
#X text 28 87 reset back to 0 when it starts;
#X text 356 587 24 pulses per quarter note output;
#X text 503 50 metro speed in ms;
#X text 298 48 start stop;
#X connect 0 0 28 0;
#X connect 1 0 2 1;
#X connect 2 0 11 0;
#X connect 3 0 4 1;
#X connect 4 0 3 0;
#X connect 4 0 5 0;
#X connect 4 0 8 0;
#X connect 5 0 6 0;
#X connect 7 0 4 1;
#X connect 8 0 9 0;
#X connect 9 0 7 0;
#X connect 10 0 17 0;
#X connect 11 0 4 0;
#X connect 12 0 4 0;
#X connect 13 0 14 0;
#X connect 13 0 16 0;
#X connect 13 0 25 0;
#X connect 14 0 15 0;
#X connect 15 0 11 1;
#X connect 16 0 12 1;
#X connect 17 0 20 0;
#X connect 17 1 7 0;
#X connect 17 2 7 0;
#X connect 18 0 22 0;
#X connect 19 0 13 0;
#X connect 20 0 12 0;
#X connect 20 1 18 0;
#X connect 20 2 19 0;
#X connect 20 3 21 0;
#X connect 21 0 18 0;
#X connect 22 0 13 0;
#X connect 26 0 27 0;
#X connect 27 0 13 0;
#X connect 28 0 2 0;
#X connect 28 1 7 0;
#X restore 213 256 pd mainmetro;
#X obj 214 124 inlet;
#X obj 355 111 inlet;
#X obj 305 663 spigot 1;
#X obj 141 659 spigot 0;
#X obj 422 523 r midi-clock-present;
#X obj 422 547 ==;
#X obj 355 142 i;
#X obj 144 753 outlet;
#X obj 235 710 s bpm;
#X obj 335 754 outlet;
#N canvas 239 342 450 300 triplets 0;
#X obj 73 41 inlet;
#X obj 58 168 outlet;
#X obj 76 86 sel 0 8 16;
#X connect 0 0 2 0;
#X connect 2 0 1 0;
#X connect 2 1 1 0;
#X connect 2 2 1 0;
#X restore 361 378 pd triplets;
#N canvas 600 167 450 300 sixteenths 0;
#X obj 73 41 inlet;
#X obj 58 168 outlet;
#X obj 76 86 sel 0 6 12 18;
#X connect 0 0 2 0;
#X connect 2 0 1 0;
#X connect 2 1 1 0;
#X connect 2 2 1 0;
#X connect 2 3 1 0;
#X restore 457 379 pd sixteenths;
#X obj 361 405 s triplets;
#X obj 457 406 s sixteenths;
#X obj 119 409 s quarters;
#X obj 239 408 s eighths;
#X text 32 504 if getting clock from MIDI \, measure the BPM;
#N canvas 236 394 450 300 quarters 0;
#X obj 73 41 inlet;
#X obj 73 75 sel 0;
#X obj 73 111 outlet;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X restore 119 379 pd quarters;
#N canvas 668 208 450 300 eighths 0;
#X obj 73 41 inlet;
#X obj 75 120 outlet;
#X obj 76 86 sel 0 12;
#X connect 0 0 2 0;
#X connect 2 0 1 0;
#X connect 2 1 1 0;
#X restore 239 379 pd eighths;
#X obj 499 340 s 24ppq;
#X obj 562 631 r 24ppq;
#X msg 562 659 248;
#X obj 562 681 midiout;
#X text 183 7 a MIDI enabled master metronome;
#X text 411 761 separate BPM midi and internal for display purposes
;
#X text 528 596 send ticks out as midiclock;
#X text 410 111 bpm input;
#X msg 669 628 250;
#X text 566 387 add other beat div calculations here ..., f 23;
#X text 184 27 start stop in left \, BPM in right. The BPM input is
ignored in presence of MIDI clock. The mainmetro sub patch switches
automatically between MIDI clock and 24 pulses per quarter note internal
clock. The resultant pulses are sent out as MIDI clock to sync downstream
gear.;
#X connect 0 0 5 0;
#X connect 1 0 4 0;
#X connect 1 0 8 0;
#X connect 2 0 3 0;
#X connect 3 0 9 0;
#X connect 4 0 5 1;
#X connect 5 0 2 0;
#X connect 5 0 23 0;
#X connect 5 0 16 0;
#X connect 5 0 17 0;
#X connect 5 0 24 0;
#X connect 5 0 25 0;
#X connect 6 0 0 0;
#X connect 7 0 12 0;
#X connect 8 0 14 0;
#X connect 8 0 15 0;
#X connect 9 0 14 0;
#X connect 9 0 13 0;
#X connect 10 0 9 1;
#X connect 10 0 11 0;
#X connect 11 0 8 1;
#X connect 12 0 1 0;
#X connect 16 0 18 0;
#X connect 17 0 19 0;
#X connect 23 0 20 0;
#X connect 24 0 21 0;
#X connect 26 0 27 0;
#X connect 27 0 28 0;
#X connect 33 0 28 0;
