abcjs icon indicating copy to clipboard operation
abcjs copied to clipboard

The MIDI doesn't handle variant endings and repeats properly

Open goplayerjuggler opened this issue 2 years ago • 4 comments

The MIDI doesn’t work properly for alternate endings / repeated sections. Here's an example:

X: 5 T: La Cardeuse R: reel M: 4/4 L: 1/16 Q: 1/4=115 Z: Malcolm Schonfield P:A4.B3 K: Gmaj [P:A] |:B2BB EBGB dedB cdcB |1,3 AGFG A2FA dedc BAGA:|2 AGFG A2FA d2F2 G2z2 :|4 [M: 5/4] AGFG A2FA d2F2 G2Bc dcBc || [P:B] |: d2g2 d2g2 d2g2 D2AB cBAB |1,2 c2a2 c2a2 a2a2 D2Bc dcBc :|3 [M: 4/4] c2a2 g2f2 g2g2 g2!D.C.!z2|]

Direct link to view it in drawthedots: https://editor.drawthedots.com/?t=X%3A%205%0AT%3A%20La%20Cardeuse%0AR%3A%20reel%0AM%3A%204%2F4%0AL%3A%201%2F16%0AQ%3A%201%2F4%3D115%0AZ%3A%20Malcolm%20Schonfield%0AP%3AA4.B3%0AK%3A%20Gmaj%0A%5BP%3AA%5D%20%7C%3AB2BB%20EBGB%20dedB%20cdcB%20%7C1,3%20AGFG%20A2FA%20dedc%20BAGA%3A%7C2%20AGFG%20A2FA%20d2F2%20G2z2%20%3A%7C4%20%5BM%3A%205%2F4%5D%20AGFG%20A2FA%20d2F2%20G2Bc%20dcBc%20%7C%7C%0A%5BP%3AB%5D%20%7C%3A%20d2g2%20d2g2%20d2g2%20D2AB%20cBAB%20%7C1,2%20c2a2%20c2a2%20a2a2%20D2Bc%20dcBc%20%3A%7C3%20%5BM%3A%204%2F4%5D%20c2a2%20g2f2%20g2g2%20g2%21D.C.%21z2%7C%5D%0A

goplayerjuggler avatar Mar 15 '23 10:03 goplayerjuggler

Interesting. Yes, that's a bug. I'll add this to my test suite.

paulrosen avatar Mar 15 '23 16:03 paulrosen

By the way, the title (T:) of my example above was wrong, it should be: T: Cotillon de Baie-Ste-Catherine

Also on this topic, I was playing around with consecutive alternate endings in order to gain in concision, so here is a second variant, it could be a test case. The interesting bit is the fragment [2,4 d2F2 [2G3A :| [4 G3B |. I'm not sure if it's "legal" or not!

X: 1 T: Cotillon de Baie-Ste-Catherine R: reel S: Laurie Hart D: Danse ce soir ! Traditional tunes of Québec • 2001 F: https://music.youtube.com/watch?v=MIXYs91NGH8 M: 4/4 L: 1/16 Q: 1/4=110 Z: Transcribed by Malcolm Schonfield P:A4.B3 K: Gmaj G3A[P:A] |: B2BB EBGB dedB cdcB | AGFG A2GB [1,3 dedc BAGA:| [2,4 d2F2 [2G3A :| [4 G3B | | [M:1/4] dcBc [P:B] |: [M:5/4] d2g2 D2g2 D2g2 D2BB cBAB |1,2 c2a2 A2a2 a2a2 D2Bc dcBc :|3 [M: 4/4] c2a2 g2f2 g2g2 !D.C.!|]

https://editor.drawthedots.com?X%3A%201%0AT%3A%20Cotillon%20de%20Baie-Ste-Catherine%0AR%3A%20reel%0AS%3A%20Laurie%20Hart%0AD%3A%20Danse%20ce%20soir%20!%20Traditional%20tunes%20of%20Qu%C3%A9bec%20%E2%80%A2%202001%0AF%3A%20https%3A%2F%2Fmusic.youtube.com%2Fwatch%3Fv%3DMIXYs91NGH8%0AM%3A%204%2F4%0AL%3A%201%2F16%0AQ%3A%201%2F4%3D110%0AZ%3A%20Transcribed%20by%20Malcolm%20Schonfield%0AP%3AA4.B3%0AK%3A%20Gmaj%0AG3A%5BP%3AA%5D%20%7C%3A%20B2BB%20EBGB%20dedB%20cdcB%20%7C%20AGFG%20A2GB%20%5B1%2C3%20dedc%20BAGA%3A%7C%20%5B2%2C4%20d2F2%20%5B2G3A%20%3A%7C%20%5B4%20G3B%20%7C%0A%7C%20%5BM%3A1%2F4%5D%20dcBc%20%20%5BP%3AB%5D%20%7C%3A%20%5BM%3A5%2F4%5D%20d2g2%20D2g2%20D2g2%20D2BB%20cBAB%20%7C1%2C2%20c2a2%20A2a2%20a2a2%20D2Bc%20dcBc%20%3A%7C3%20%5BM%3A%204%2F4%5D%20c2a2%20g2f2%20g2g2%20!D.C.!%7C%5D%0A

Thanks; best regards

goplayerjuggler avatar Mar 27 '23 16:03 goplayerjuggler

"Danse ce soir" is one of my favorite recordings!

Anyway, that is strange to have a repeat that is not on the beginning of a bar. I just checked "Behind Bars", though, and that is legal. (I still think it is confusing, but whatever).

This is definitely a useful enhancement, but I don't have time to do it right away. I'd welcome a pull request, though!

A problem is that one can put anything for the ending text. Generally it is "1" and "2", but it could be "last time" or "odd times" or anything. It would still be an improvement to recognize the case where it is purely consecutive integers separated by commas.

This might be two features: getting the endings to repeat is probably a bit simpler than to handle partial measures.

paulrosen avatar Mar 28 '23 18:03 paulrosen