Midi import chooses accidentals poorly (for this file)

• Mar 28, 2015 - 19:20
S4 - Minor

For the enclosed MIDI file, which is produced by Personal Composer on Windows, a program no longer offered or supported, which has an embedded key signature of E major (four sharps, major), D#'s and A#'s are consistently imported as Eb's and Bb's respectively, which is not the designed behavior. A small test case of an E major scale produced by MuseScore and re-imported imports the as D# and A# as should be.

Attachment Size
omb2.mid 81.8 KB


See also #44226: Initial key signature not transposed via dialog on imported MIDI file. it seems the underlying cause for these issues is the same. That is, I just checked, and sure enough, the initial key signatures in the problem file here are also marked as "generated". It appears that no key signature is being created in the first measure for these files, so one is being generated during layout in the same way it normally is on subsequent systems (eg, the way key signatures normally repeat on all systems). But creating the initial key signature during layout is way too late in the game to affect note spelling. The initial key signature *should* have been created normally before the notes were read from the file.

For "good" MIDI files, initial key signatures are generated in MTrack::createKeys(). But for whatever reason, this is not happening for the problem files. I am theorizing that the key signatures are recorded in the MIDI file in an unexepcted way, something that results in them appearing in the key map too late for createKeys() to see them. But that's just an educated guess, really.

Status (old) fixed active

The incorrect spelling issue seems to still exist for the attached file. The key signature seems to be generated correctly - which is to say, it is now marked non-generated. But somehow, the spelling of notes is still not correct - see the G# in measure 4 of the violin 1 part (top staff). With a key signature that includes A, , this should be spelled Ab. Somehow, at the point when we are deciding how to spell that note, the key is still not set, it seems. Not sure of the reason.

Attachment Size
Saturday Night.mid 25.83 KB