
The task is to implement a   metronome.

The metronome should be capable of producing high and low audio beats, accompanied by a visual beat indicator, and the beat pattern and tempo should be configurable.

For the purpose of this task, it is acceptable to play sound files for production of the beat notes, and an external player may be used.

However, the playing of the sounds should not interfere with the timing of the metronome.

The visual indicator can simply be a blinking red or green area of the screen (depending on whether a high or low beat is being produced), and the metronome can be implemented using a terminal display, or optionally, a graphical display, depending on the language capabilities.

If the language has no facility to output sound, then it is permissible for this to implemented using just the visual indicator.




#N canvas 553 78 360 608 10;
#X obj 20 20 cnv 15 320 140 empty empty empty 20 12 0 14 -228856 -66577 0;
#X obj 20 190 cnv 15 320 36 empty empty empty 20 12 0 14 -233017 -66577 0;
#X obj 67 30 vradio 20 1 0 6 empty beats empty 0 -8 0 10 -86277 -262144 -1 1;
#X text 40 33 1/1;
#X text 40 53 2/2;
#X text 40 73 3/4;
#X text 40 93 4/4;
#X text 40 133 6/8;
#X obj 67 167 + 1;
#X floatatom 67 201 5 0 0 0 beats - -;
#X obj 181 32 vsl 20 115 208 40 0 0 empty bpm empty 25 10 0 10 -86277 -262144 -1 5971 0;
#X text 208 42 Larghetto 60-66;
#X text 208 58 Adagio 66-76;
#X text 208 74 Andante 76-108;
#X text 208 90 Moderato 108-120;
#X text 208 106 Allegro 120-168;
#X text 208 122 Presto 168-200;
#X text 208 138 Prestissimo 200-208;
#X text 208 26 Largo 40-60;
#X obj 181 167 int;
#X floatatom 181 201 5 0 0 1 bpm - -;
#X obj 149 246 expr 1000 / ($f1/60);
#X obj 122 125 tgl 25 0 empty on on/off -4 -7 0 10 -261682 -86277 -86277 0 1;
#X obj 122 270 metro;
#X obj 122 291 int;
#X obj 42 249 + 1;
#X obj 52 275 mod;
#X obj 122 312 moses 1;
#X obj 122 347 bng 32 250 50 0 empty empty empty 17 7 0 10 -228856 -258113 -1;
#X obj 161 347 bng 32 250 50 0 empty empty empty 17 7 0 10 -228856 -260097 -1;
#X msg 81 399 1 2 \, 1 2 1 \, 0 3 2;
#X obj 81 420 vline~;
#X msg 200 399 1 2 \, 1 2 1 \, 0 3 2;
#X obj 200 420 vline~;
#X obj 20 420 osc~ 1400;
#X obj 139 420 osc~ 1230;
#X obj 65 455 *~;
#X obj 184 455 *~;
#X obj 116 559 dac~;
#X obj 117 523 +~;
#X obj 278 490 loadbang;
#X msg 278 511 \; pd dsp 1 \; beats 1 \; bpm 120 \; on 1;
#X connect 2 0 8 0;
#X connect 8 0 9 0;
#X connect 9 0 26 1;
#X connect 10 0 19 0;
#X connect 19 0 20 0;
#X connect 20 0 21 0;
#X connect 21 0 23 1;
#X connect 22 0 23 0;
#X connect 23 0 24 0;
#X connect 24 0 25 0;
#X connect 24 0 27 0;
#X connect 25 0 26 0;
#X connect 26 0 24 1;
#X connect 27 0 28 0;
#X connect 27 1 29 0;
#X connect 28 0 30 0;
#X connect 29 0 32 0;
#X connect 30 0 31 0;
#X connect 31 0 36 1;
#X connect 32 0 33 0;
#X connect 33 0 37 1;
#X connect 34 0 36 0;
#X connect 35 0 37 0;
#X connect 36 0 39 0;
#X connect 37 0 39 1;
#X connect 39 0 38 0;
#X connect 39 0 38 1;
#X connect 40 0 41 0;
