abcjs icon indicating copy to clipboard operation
abcjs copied to clipboard

Metronome support

Open presidento opened this issue 2 years ago • 3 comments

ABC notation does not have metronome support. There is a workaround of using drum pattern, which can be quite complicated if the meter changes frequently. Also there is a bug in abcjs if the meter changes. (#849)

We can add a "metronomeVolume" parameter and abcjs can automatically calculates drum strings every time when meter changes.

Example:

M: C
L: 1/4
z4 | [M:3/4] z3 | [M:2/4] z2 | [M:6/8] z3 | [M:4/4] z4  ||

presidento avatar Feb 12 '23 19:02 presidento

At this moment this is the workaround I use for metronome. If you like the idea I can move forward and make production ready.

presidento avatar Feb 12 '23 19:02 presidento

What's the interface you were planning on using for this? The tempo and the metronome ticks need to be passed in, at least. It seems like this is exactly duplicating the existing "drum" parameter. I agree that the drum parameter is cumbersome to set up and use, but that is part of the ABC standard so I think we're stuck with it. I'd prefer fixing the bug in drum. I'll be testing that PR soon.

paulrosen avatar Mar 14 '23 21:03 paulrosen

I have about 250 small sheet musics on my site for those who cannot play some key melodies of songs by ear. For them I add metronome and pad to make practicing easier. Here is an example: https://kottak.mefju.hu/s/891

I do not code metronome drum parameter manually for all of those sheet musics. Previously I generated the drum parameters directly to ABC strings in a pre-processing phase, but when the meter changes it can be complicated. For example it is not trivial how to change this ABC notation with a script to add the proper drum parameters each time when meter changes:

M: 4/4
K: Db
L: 1/8
A, (A,D) | "Db"F3DE2(D>B,) | [M:6/4] (A,D3)-D4 z C (DF) | [M:4/4] "Db/F"A3D"Gb2"B2(A>F) |
"Db5/Ab"E8- | E4 z A (Ac) | "Gb/Bb"d3G (cB)(AG) | [M:6/4] "Db/AB"A4D4 "Gb/Bb"zD (DE) | "Db/Ab"F3A F3E D4 | [M:4/4] "Db"D8 ||

With the changes of this PR adding metronome for this ABC is pretty easy and works well for me (try it at https://kottak.mefju.hu/s/784). Yes, it duplicates the existing "drum" parameter, except it is very easy to use if you want a standard metronome and nothing else. (Which can be an initialization parameter of abcjs, not coded in ABC string.) And the drum parameter can be used for complex drum patterns if somebody needs it.

presidento avatar Mar 14 '23 23:03 presidento