Audiveris / audiveris

Latest generation of Audiveris OMR engine
https://audiveris.github.io/audiveris
GNU Affero General Public License v3.0
1.53k stars 227 forks source link

1-Line Percussion Mistakenly Sees Volta Bracket as New Staff #565

Open brian-math opened 2 years ago

brian-math commented 2 years ago

I decided to add a 5-line drum part above the 1-line hand clap (from Can't Take My Eyes Off of You) and see how the software performs. The new score is attached. The following bug was encountered on page 1 (I did not attempt to process pages 2 and 3):

Other issues with this score which may or may not be related to the above incorrect recognition of a new 1-line staff:

Can't_Take_My_Eyes_Off_of_You-Drums+Clap.pdf

Originally posted by @brian-math in https://github.com/Audiveris/audiveris/issues/33#issuecomment-1089361829

hbitteur commented 2 years ago
  • The line above the 1st ending was detected as a new 1-line staff (!!), and the little vertical line segment at the left end of the 1st ending was extended up to the full height of a 1-line barline (even after I tried again with System Indentations OFF); I think Audiveris thinks this is a new movement; in the "green notes" layer display it is numbered 20C, and bar 22 is renumbered as bar 1

This false new staff led to a false indented system, which led to a new page and of course a new sequence of measure IDs...

There is now a test on minimum staff length. Commit 5ce7298398b8499bac723291ac1f1fa91d813111 I fixed this yesterday, please make sure to work with the latest commits on development branch (by a git pull).

hbitteur commented 2 years ago

Oops, my mistake! The false staff between staves 1 and 2 on the right side is fixed. And your message is about the left side between staves 2 and 3, something I can observe.

What can we do? Perhaps a longer value for minStaffLength constant introduced yesterday? But, at the same time, we must stay able to support systems organized side by side, with shorter staff length (about half the image width).

We could think of some post analysis:

  1. Retrieve all raw staves
  2. The population of raw staves should give us the typical length of a full staff in current sheet.
  3. Then accept a half staff only if it faces another half staff. Otherwise we consider the staff as invalid.

This approach should be reserved to the scores for which the 1-line staves switch has been set to true.

What do you think?

hbitteur commented 2 years ago

For the time being and to move forward, we simply increase constant minStaffLength from 30 (interlines) to 40 using the Tools | Options dialog

hbitteur commented 2 years ago
  • All of the x heads and stems on the space above the top line in the 4th (actual) D.Set staff, starting at bar 22, were discarded (even though such x heads and stems were correctly recognized in all other staves)

I can't see any "x heads" in this whole sheet. Measure 22 contains 4 quarter notes (oval heads). Are we still talking of Can't take etc...?

Update: Our OMR engine cannot yet recognize multi-measure rests, so the very first measure had ID 1 and the next measure has ID 2 (rather than 9). So perhaps your measure 22 is measure 15 for the engine. If so it contains the sequence: quarter rest, quarter note, 8th rest, 8th note, quarter note and is still well recognized. No X at all. Could you confirm which measure IDs you are using?

Oh nooo! This is a new PDF file, not the Can't Take ... initial score. I hadn't noticed. For me hare#1 was Twist & Shout, and hare#2 was Can't take Hence the need to keep separate issues!!!

hbitteur commented 2 years ago

Now I can see the false system 4, located just above the D.Set staff. It does look like a rather long 1-line staff. For the time being, I put minStaffLength to 75, but this is not a real solution.

OK, the X's at beginning of indicated measure 22 (D.Set staff) have survived the REDUCTION step. In measure 26 the beam is OK.

Moved on to PAGE step. Everything looks OK except the multi-measure rests of course. Just 2 measures in pink on first staff (measures physical IDs: 3 and 6). I think some rests are missing in these measures, for example in measure 3 the first x-shape quarter is shifted to the right, compared with the half-rest sign above in the same staff. Similar problem with measure 6.

Manually inserting quarter rests before these x-shaped quarters fixed the rhythm problem: image

hbitteur commented 2 years ago

We need to think about a solution for the long 1-line pseudo staff.

Meanwhile, I will start working on multi-measure rests, something already asked by other users.

brian-math commented 2 years ago

"For the time being, I put minStaffLength to 75, but this is not a real solution....We need to think about a solution for the long 1-line pseudo staff."

I wonder if the engine can recognize the combination of lines above a volta: there's a long horizontal line, with a short vertical "hook" extending down from its left end (but not up). Whereas a bar in the 1-line staff begins with a horizontal line with a somewhat long vertical hook extending both up and down from its left end. Can the engine detect either the absence of a vertical hook going up, or the short total length of the vertical hook -- presumably it knows the length of a bar line for the 1-line staff, since it substituted such a bar line for short the vertical hook that was present in the scan.

I mentioned in an earlier post on the other thread that I noticed missing quarter rests, and confusingly positioned eighth rets, in measures 4 and 8. I'll fix those in MuseScore and post the updated PDF file when I get a chance.

hbitteur commented 2 years ago

I wonder if the engine can recognize the combination of lines above a volta: there's a long horizontal line, with a short vertical "hook" extending down from its left end (but not up). Whereas a bar in the 1-line staff begins with a horizontal line with a somewhat long vertical hook extending both up and down from its left end. Can the engine detect either the absence of a vertical hook going up, or the short total length of the vertical hook -- presumably it knows the length of a bar line for the 1-line staff, since it substituted such a bar line for short the vertical hook that was present in the scan.

These "Volta" signs are called "Ending" signs in MusicXML (and in Audiveris as well). They are detected during the CURVES step. The problem here is that we are very early in the score processing (GRID step) and we have very little information to play with (clusters of long horizontal lines, some vertical lines (barlines)). That's about all we have.

Perhaps we should play with just the population of detected raw lines. What is a typical minimum vertical distance between a staff and the next one? Even with 1-line staves. My guess is that an ending horizontal line is generally close to the staff below, much closer than the distance between two staves.

In the example at hand:

Perhaps a combined test on staff length + test on vertical distance. Update: The analysis of distribution of staff vertical distances in a sheet may help us.

brian-math commented 2 years ago

I made a new version in MuseScore of Can't Take My Eyes Off of You - Drums+HandClap [attached] which:

I set the minStaffLength parameter to 75.0. Sheet 1 now processes almost perfectly! The only mistakes I noticed were:

There were no pink bars flagged for rhythm errors, even bar 7 with the missing quarter rest. Evidently the whole rest in the top voice of this bar was enough to keep it from being flagged.

Can't_Take_My_Eyes_Off_of_You-Drums+HandClap.pdf

brian-math commented 2 years ago

The minStaffLength = 75.0 fails on this 1-line percussion score with only one part (renamed OnePart1LineScore to avoid confusion, because it's still based on Can't Take My Eyes Off of You, but with just the Hand Clap part, cleaned up to avoid multi-bar rests).

The problem is the last staff length is shorter than the 75 times interline, so it gets ignored completely. With this setting, the score is otherwise recognized fairly well. The 2nd bar line (under the "d" of "Moderato") is missed, but the resulting long second bar, with two whole note rests, does not get flagged in pink at the end. [For many steps there was an extra bar line near the beginning of the 3rd staff (perhaps a mis-identification of the right half of the drum clef glyph), but it seems that this empty bar was finally discarded at the PAGE step.]

But setting minStaffLength back to 30.0 is worse. Now there are three extra "fake" systems detected: two coming from "ghost" lines above and below the song title, and one coming from the 1st and 2nd endings (as previously). The CURVES step crashes with a NullPointerException in sheet.Staff.getClosedStaffLine (java.awt.geom.Point2D) because "staff" is null.

I also tried minStaffLength = 35.0, because I thought that might be big enough to capture the last system, but it wasn't; and the three extra systems just mentioned were still mistakenly included.

OnePart1LineScore.pdf

hbitteur commented 2 years ago

This minStaffLength is just part of the protection. I need to work on something more robust. Give me some time.

hbitteur commented 1 year ago

Should we close this issue now?