Notes not entered in first measure entered into wrong octave

• Feb 26, 2019 - 19:26
Reported version
P1 - High
S4 - Minor

In the attached score, Haydn 8th symphony.mscz

In the Oboe, enter a G into a measure besides the first.

Result: you get a G3
Expected: You get a G4.

All notes not entered in the first measure are between G3 and F#4, an octave below what is expected.

With further testing I see in the attached score, all treble clef notes appear an octave low, bass clef notes appear an octave high and alto clef notes are displayed as expected.


What I mean is, it.seems.likely to be a result of the notes in those invisible that is somehow setting the default, not the mere fact the staves are invisible.

Anyhow, I've curious about this glitch a while now, maybe today is finally the day I look...

OK, I think I understand the problem. The algorithm normally starts backtracking from the cursor to find the previous note on the staff, and assuming it finds a note, it will use that as a starting point and then pick the closest pitch. But, if it finds a clef first, it gives up looking for a previous note (which may well be in a totally inappropriate octave for the current clef) and instead chooses a note that makes sense for the clef.

This is all well and good and I think would produce good results in most cases, but it fails here because the algorithm doesn't see the initial clef except when starting in the first measure. That's because the initial clef is represented differently from clef changes. So we think there is nothing to base our decision on and pick the closest note to middle C.

It's an easy fix if we agree the goal of the algorithm is good (and I think it is).

Your analysis seems to cooberate what I see when I enter notes and agree that the note entered should be on the staff if there are no notes on it previously.

Fix version