abc2svg icon indicating copy to clipboard operation
abc2svg copied to clipboard

play-1.js: add support for metronome + count-in

Open joaocc opened this issue 8 years ago • 6 comments

Hi, Do you have anything lined up to (optionally) play a metronome sound on top of the current generated sound? If this is the case, it would also be great to have a count-in of 1 or 2 bars (ie, just the metronome sound for 1 or 2 bars before starting the visual and audio). Thx

joaocc avatar Sep 08 '17 17:09 joaocc

I have no use of a metronome, but you can do it yourself: just replace play.js and add the metronome before the call to toaudio5.play (the audiocontext is in 'ac' in the 'conf' object ).

moinejf avatar Sep 09 '17 15:09 moinejf

How would you suggest we sync the metronome beats with the note outputs? Is there any callback that is being triggered on the tempo? Thx

joaocc avatar Sep 09 '17 15:09 joaocc

A simple solution: add a 'metronome' voice. In your version of play.js, wrap the AbcPlay method 'add()'. In add(), you get the symbol list which is sorted by time and the voice table. Then, add a voice, insert the metronome notes in this voice and lnsert these notes at the right time in the symbol list. For the metronome to start before the tune, shift all the 'time's of the symbols.

moinejf avatar Sep 10 '17 06:09 moinejf

Thx! We will look into that.

joaocc avatar Sep 10 '17 10:09 joaocc

@joaocc did you implement @moinejf's proposal?

bwl21 avatar Nov 04 '17 15:11 bwl21

Not yet. At this moment we have a "plain" metronome playing a bit before. However, we will probably do a "silent" count-in (1 or 1/2 bar), followed by a 1 bar with metronome, and then start the playalong. Also, at the moment, we don't know if we have the js-fu to implement it the way @moinejf suggested.

joaocc avatar Nov 04 '17 20:11 joaocc