gregchapman-dev / converter21

A music21-based music notation file format converter CLI app, and some new sub converter plug-ins
Other
16 stars 1 forks source link

Score is not parsed #7

Closed PRamoneda closed 1 year ago

PRamoneda commented 1 year ago

I am parsing the score: from Craig Sapp collection: wtc2f24.krn.zip

and it is not possible to load it to music21

minimum example

converter.unregisterSubconverter(converter.subConverters.ConverterHumdrum)
converter.registerSubconverter(HumdrumConverter)
s = converter.parse(
  humdrum_path,
  format='humdrum'
)
list_elements_music21 = [e for e in s]

and list_elements_music21 is empty.... it is not loading anything

Some idea?

gregchapman-dev commented 1 year ago

Thanks for the report! I'll take a look.

PRamoneda commented 1 year ago

thanks to you for this library :) say to me if I can help!

gregchapman-dev commented 1 year ago

I'm seeing the following error:

Error: Inconsistent rhythm analysis occurring near line 716 Expected durationFromStart to be: 149.5 but found it to be 149.0 Line: 4.BBB 4.d# 4.b

Looking further to see what's going on.

gregchapman-dev commented 1 year ago

Aha! Here's the final measure in the file:

=101 =101 =101 . 8eQ 8a#Q 4.BBB 4.d# 4.b

Those two 'Q's should be 'q' to show they are grace notes (they are being treated as eighth-notes by my parser). I'm looking to see if I should support 'Q' as a variation on 'q', but in the meantime it should be easy to fix your file so it will parse.

gregchapman-dev commented 1 year ago

BadGraceNotes.pdf

verovio.humdrum.org has the same issue with this file. I don't think I should allow 'Q' to mean grace note.

PRamoneda commented 1 year ago

Thank you so much for your answer!

And well, maybe it is better to output a warning and not returning and empty file

gregchapman-dev commented 1 year ago

I do output an error message to stderr (I posted it above), but the last measure doesn’t make sense, so I can’t really produce a music21 score, unless you want the output score to just stop at the first error I see. I think it is better to fail, with an error printed to stderr.

Greg

On Aug 24, 2022, at 10:24 AM, Pedro @.***> wrote:

well, maybe it is better to output a warning and not returning and empty file

— Reply to this email directly, view it on GitHub https://github.com/gregchapman-dev/converter21/issues/7#issuecomment-1226018799, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR6X47DK5FHBNUIRMALSYV3V2ZLDJANCNFSM57MG2Y7Q. You are receiving this because you commented.

PRamoneda commented 1 year ago

Another problem is in wtc1p02.krn it seems to block forever converter21

PRamoneda commented 1 year ago

but dont worry I am opening the files and they have strange things. I am going to think in using another machin-readable version of wtc.

Do you have some idea of the nocturne problem?

gregchapman-dev commented 1 year ago

Can you point me at the wtc files you are trying? I have a lot of Humdrum files that Craig Sapp pointed me at (about 4000), but not these.

PRamoneda commented 1 year ago

here

gregchapman-dev commented 1 year ago

Thanks! Any chance you have a zip file full of all of them? I'd like to add them to my local test suite, and individually downloading each of them sounds painful.

gregchapman-dev commented 1 year ago

Do you have some idea of the nocturne problem?

Which problem is this?

PRamoneda commented 1 year ago

wtc 2.zip

PRamoneda commented 1 year ago

I am trying to visualise the humdrum files from music21 with your converter21 library and if we convert them to musicxml something goes crazy with the voices adding a lot of hidden silences. However, if you download the score in musicxml from here: https://chopinscores.org/en/partytura/23 the conversion is very very clean. And they only convert with the cpp version two years ago the humdrum to musicxml.

I show in the next lines an example with Chopin, Nocturne 1er; Op. 9 (publisher: Kistner):

The original humdrum (verovio):

After converter21 or after VHV web conversion:

Captura de pantalla 2022-08-22 a las 18 26 19

However, downloading the score from the chopinscores website it is very very clean:

Captura de pantalla 2022-08-22 a las 18 23 46

PRamoneda commented 1 year ago

the same if I can help with something say me :) thank you so much

gregchapman-dev commented 1 year ago

Thank you for the wtc scores! I will add them to my test suite, and fix any bugs I find.

Here is an explanation of the extra voices containing invisible rests:

This is a side effect of the way that music21 stores DynamicWedges (Crescendo and Diminuendo). DynamicWedges are Spanners containing a start note/chord/rest and an end note/chord/rest, so the “duration” of the DynamicWedge is determined from the range of those two spanned notes/chords/rests. Unfortunately, those spanned notes/chords/rests must both be in the same Part/PartStaff, so if the Humdrum file has put the start or end of a ‘>' or ‘<' on a note in another staff (and this happens often, in piano scores), my Humdrum parser has to create a correctly positioned invisible rest in the current staff to correctly position the DynamicWedge. This also means I have to add a Voice to the current Staff to put the invisible rest in. I try very hard not to do this; if there is a correctly positioned note/chord/rest already in the current staff, I will use that instead.

This problem is not limited to my Humdrum parser: if the music21 Humdrum and MEI parsers supported Crescendo and Diminuendo, they would have to do the same thing.

I am in the process of putting together a proposal for music21, to support Crescendos and Diminuendos that are not Spanners, but instead have an offset and duration. Once that is in place in music21, my Humdrum parser can stop making those invisible rests.

On Aug 25, 2022, at 11:01 AM, Pedro @.***> wrote:

the same if I can help with something say me :) thank you so much

— Reply to this email directly, view it on GitHub https://github.com/gregchapman-dev/converter21/issues/7#issuecomment-1227595398, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR6X47AZYNTRRLSAPT4ISETV26YHPANCNFSM57MG2Y7Q. You are receiving this because you commented.

gregchapman-dev commented 1 year ago

OK, I have done some analysis of various Humdrum parser failures on the wtc scores. I have fixed the infinite loop (triggered by '*staffX', where X is not numeric). I have also gone ahead and made 'Q' the equivalent of 'q'. 'Q' in Humdrum is supposed to be a weird variation of a grace note that actually extends the duration of a measure. But Verovio's Humdrum parser is very picky about durations (and so is mine), so we need to treat it like a grace note. Maybe someday Verovio will as well? Right now it just fails to parse.

You can expect a release of converter21 soon that has those fixes.

The rest of the wtc scores seem to parse fine, with a few exceptions due to incorrectly encoded tuplets.

PRamoneda commented 1 year ago

Thank you for the wtc scores! I will add them to my test suite, and fix any bugs I find.

thanks to you for this library!

This is a side effect of the way that music21 stores DynamicWedges (Crescendo and Diminuendo). DynamicWedges are Spanners containing a start note/chord/rest and an end note/chord/rest, so the “duration” of the DynamicWedge is determined from the range of those two spanned notes/chords/rests. Unfortunately, those spanned notes/chords/rests must both be in the same Part/PartStaff, so if the Humdrum file has put the start or end of a ‘>' or ‘<' on a note in another staff (and this happens often, in piano scores), my Humdrum parser has to create a correctly positioned invisible rest in the current staff to correctly position the DynamicWedge. This also means I have to add a Voice to the current Staff to put the invisible rest in. I try very hard not to do this; if there is a correctly positioned note/chord/rest already in the current staff, I will use that instead.

The same, if you need some help say me

In the next weeks I am going to review a large part of the craig sapp Humdrum collection (parsed by converter21). If you want we can keep this thread open and I report here if I find more errors

thank you so much again!

gregchapman-dev commented 1 year ago

Craig has asked me to back out my support for 'Q' as equivalent to 'q', as he wants (in future) to have 'Q' mean cue-sized (small) notes, not grace notes. He will be updating the wtc scores to use 'q' instead of 'Q'.

gregchapman-dev commented 1 year ago

Hi Pedro, I'm going to close this out. If you find a particular score that shows a problem, please open a new issue.