Incorrect key signature?

• Aug 20, 2020 - 01:16

When I load the attached file I see a key signature with 2 sharps, but it should be C major. All the notes have accidentals which negate the key signature, so it plays the right notes.

I have no idea what to make of this, but this is the first thing I have done with Musescore since I installed the latest update.

Attachment Size
Fantasisa1-a6.mid 8.38 KB


MuseScore 3.3.4 does the same, so it is not anything that broke with 3.5.0
AFAIK MIDI doesn't carry information about the key signature, so the import tries to guess it, and here just goes wrong apparently

In reply to by Jojo-Schmitz

I don't know if there is any key signature info in MIDI files, but I can say that Scorewriter and Cakewalk Sonar have shown the correct key signature for all MIDI files that I have opened in them. It seems disappointing and alarming that Musescore would volunteer 2 sharps. If I have other files that musescore gets the key wrong would you like me to upload them?

My guess is the information about key is only on an empty "control" track. MuseScore will see it if you make sure to export the key signature onto each track.

In reply to by Marc Sabatella

Hm.... Well first of all, I wouldn't know how to export the key signature onto every track!

In any case, I am finding that sometimes musescore shows the correct key signature and sometimes not. In the first file attached, the key signature is one flat, but musescore shows 2 sharps.

In the second file the key signature is two flats and musescore agrees.

In both cases the key signature is specified once in each file, as the third event.

Attachment Size
Fantasisa5-a6.mid 6.85 KB
Fantasia1-a4.mid 6.5 KB

In reply to by tpgettys

You would need to consult the documentation for the program you are using to create the MIDI files to learn how to to get it to put a key signature on each track, but I would assume any decent sequencer would support that.

Absent this info, MuseScore needs to guess. It stands to reason sometimes it will guess right, other times wrong.

In reply to by Marc Sabatella

I may be wrong about this, of course, but I believe the key signature event is channel-less, that is, it applies across all voices. You can see this in the screen-shot provided above.

In any case, the key signature is embedded in all of these files; musescore has no need to guess at the key signature, it just needs to be used.

In reply to by tpgettys

As far as I know, a MIDI file has separate tracks, there is no such thing as global info of this nature, except that some programs take the approach of using the first track to apply globally, with no other data there. That is what your file seems to do, but MuseScore doesn’t do that, it looks at each track individually. Any decent sequencer should be able to deal with that, but you might have to look up how.

In reply to by Marc Sabatella

Now that I think about it, I have never had to deal with transposing instruments, so I expect there is a need for key signatures to be specified on the track level in some cases.

However, the bulk of the MIDI files I have were not created by me; I have no way to "fix" them, and it isn't necessary anyway. They contain all the key signature information that is necessary; it is unambiguous and should be simple enough for musescore to use it as the default key signature for all tracks until and unless it is over-ridden.

In reply to by Marc Sabatella

Master-Track (or Control-Track or Tempo Track) has been used by industry-leading companies such as Rol4nd and yamah4 for years. I have worked with hardware and software sequencers (sound recording studios) for years.

Master-Track works like System elements in Musescore. It's unnecessary to write this information in each track because this information is global. Also, the MIDI-file interpreter doesn't calculate tempo (time-sig, etc) separately for each track.

(From MMA's "Complete MIDI 96-1-3" specification; with advanced examples)

Example: Suppose you do ritardando (ie decrease the tempo) you don't write this information on each of the 16 tracks. you just write on the Master-track (first track of the SMF Type1).
Or you have made permanent modulation from one key to the other. you don't write such information on all tracks, you just write on the Master track.
Or you switched from 4/4 pace to 6/8. You don't want to write this on all 16 tracts individually. You just write on the Master track.
Or Marker events (like "Section A", "Bridge", "Intro", "Final", etc) ...

Can you understand the logic?

Some sequencer software automatically carries this information to the Master / Control /Tempo track, regardless of which track it is on, some software will alert you, and the remaining software will ignore this information silently. Note: Since some DAW's keep Audio, MIDI and VST separately, it may be correct to provide track-based information on them, but this is not an SMF implementation.

I also find the term "Decent" used here strange.

In reply to by Ziya Mete Demircan

Yes, I am aware there is convention used by many to have a master track. Some use it only for tempo and time signature changes, and there I absolutely see the value. It's much less clear why this same model should be used for key signatures, though., but some apparently some implementations do this. I'm not aware of anything in the MIDI spec that actually calls for or otherwise sanctions this, but I'm not an expert. So I certainly wouldn't be the one trying to change our own implementation. I'm just trying to help people see how they actually can create MIDI files that work as expected, by embedding key signature information the way we expect it.

I would think that any software that was written first and foremost to help you edit MIDI data would provide controls for this, just as software like MuseScore that was written first and foremost to help you edit notation data provides system vs staff text etc. But maybe there exist some sequencers that lack this control, just as there are presumably some notation programs that lack the concept of "system text". So, we should indeed be prepared to handle output of such programs. But again, I'm not the expert, I'm not the one who could implement this. I'm just the one trying to help users achieve the desired goal today, using the tools we have.

Do you still have an unanswered question? Please log in first to post your question.