Description
The parser doesn't support durations ending with a slash, and it doesn't parse mixed-fraction durations correctly. For example,
G/
parses and G3/2
parses, but G3/
does not.
Here is an example from the ABC website that I'm trying to parse, where this appears a lot:
X:2 T:8th Sonata for piano %%staves {1 2} C:L. van Beethoven M:C L:1/16 Q:1/8=66 F:http://richardrobinson.tunebook.org.uk/tune/6525 K:Cm % .. even when there are a lot of notes V:1 !fp![E,4G,4C4]- [E,3/G,3/C3/]!3![G,/C/]!4![G,3/=B,3/D3/]!5![G,/C/E/] ([=A,4C4E4]!4![=B,2D2])z2| !fp!!3![=B,4D4F4]- [B,3/D3/F3/][B,/D/F/][B,3/D3/G3/][B,/D/A/] ([B,4D4A4]!3![C2E2G2])z2| V:2 [C,,4E,,4G,,4C,4]- [C,,3/E,,3/G,,3/C,3/]!2!E,/!3!D,3/!4!C,/ (!2!^F,4G,2)z _A,,| _A,4-A,3/!2!A,/!1!G,3/=F,/ E,4-E,2z2|
Related to this, durations with mixed fractions aren't parsed correctly:
f11/4
should be read as "1 and 1/4", i.e., equivalent to f5/4
, but instead it is read as "eleven quarters".
This type of thing appears a lot in ABC found online, for example, in http://www.thefatlute.eu/rapid/view_song/g/1122/407
In my ABC sequencer, this is what I am using to parse durations - not sure it's 100% correct, but it seems to work in practice with music people have posted. https://github.com/PencilCode/musical.js/blob/master/musical.js#L1282