Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Durations not parsed correctly #6

Open
davidbau opened this issue May 24, 2014 · 0 comments
Open

Durations not parsed correctly #6

davidbau opened this issue May 24, 2014 · 0 comments

Comments

@davidbau
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant