Quantcast
Channel: Hooktheory Forum - Latest topics
Viewing all articles
Browse latest Browse all 2662

MIDI export: incorrect key signature event xFF\x59\x02 (major/minor byte)

$
0
0

Hi,

When exporting midi files in Hookpad the key signature is incorrectly written. The number of sharps/flats appears to be correct, but the byte which indicates whether the key is major or minor is left empty so all keys are interpreted as major.

I’ve confirmed this myself from the midi spec and with a hex editor, then asked ChatGPT to confirm which it did after writing a Python script to analyze a file I exported which was a simple chord progression in Em. The forum doesn’t allow uploading .mid, .zip so I just pasted the chords directly from Hookpad at the bottom.

This shows the file in hex. FF 59 02 indicates the location of the key signature event. 01 indicates 1 sharp, however the scale type value is incorrect (or possibly never written so defaults to major)
MIDI hex2

Thanks

The following is from ChatGPT-4:

The key signature event in the “Em MIDI Test.mid” file is 01 00. The bytes break down as follows:

  • 01 represents the key signature. In this case, as a signed byte, it stands for 1 sharp. This is typical for the key of G major or E minor, both of which share the same single sharp (F#) in their key signature.
  • 00 represents the scale type, which indicates a major scale. This is contradictory to your expectation of it being E minor, as a minor scale would be indicated by 01.

Given that you’ve set the project as Em and you’re expecting a minor key signature, the metadata should indeed show 01 01 (1 sharp and minor scale), but it’s showing 01 00 (1 sharp and major scale) instead. This is likely why Reaper is displaying G major as the key. It seems the issue might be related to how the key signature is being set or interpreted in the software or website you used to create the MIDI file, as it is not marking the file as minor despite your settings.

It might be worth verifying the settings or methods used when exporting or setting up the MIDI file in your music creation tool to ensure the minor key is correctly encoded. If it’s consistently incorrect, you might need to check for software updates, documentation, or support regarding key signature handling.

Hookpad information to recreate the project if needed:

{“chords”:[{“root”:1,“beat”:1,“duration”:4,“type”:5,“inversion”:0,“applied”:0,“adds”:[],“omits”:[],“alterations”:[],“suspensions”:[],“pedal”:null,“alternate”:“”,“borrowed”:“”,“isRest”:false,“recordingEndBeat”:null},{“root”:5,“beat”:5,“duration”:4,“type”:5,“inversion”:0,“applied”:0,“adds”:[],“omits”:[],“alterations”:[],“suspensions”:[],“pedal”:null,“alternate”:“”,“borrowed”:“”,“isRest”:false,“recordingEndBeat”:null},{“root”:3,“beat”:9,“duration”:4,“type”:5,“inversion”:0,“applied”:0,“adds”:[],“omits”:[],“alterations”:[],“suspensions”:[],“pedal”:null,“alternate”:“”,“borrowed”:“”,“isRest”:false,“recordingEndBeat”:null},{“root”:4,“beat”:13,“duration”:4,“type”:5,“inversion”:0,“applied”:0,“adds”:[],“omits”:[],“alterations”:[],“suspensions”:[],“pedal”:null,“alternate”:“”,“borrowed”:“”,“isRest”:false,“recordingEndBeat”:null},{“root”:1,“beat”:17,“duration”:4,“type”:5,“inversion”:0,“applied”:0,“adds”:[],“omits”:[],“alterations”:[],“suspensions”:[],“pedal”:null,“alternate”:“”,“borrowed”:“”,“isRest”:false,“recordingEndBeat”:null},{“root”:5,“beat”:21,“duration”:4,“type”:5,“inversion”:0,“applied”:0,“adds”:[],“omits”:[],“alterations”:[],“suspensions”:[],“pedal”:null,“alternate”:“”,“borrowed”:“”,“isRest”:false,“recordingEndBeat”:null},{“root”:1,“beat”:25,“duration”:4,“type”:5,“inversion”:0,“applied”:0,“adds”:[],“omits”:[],“alterations”:[],“suspensions”:[],“pedal”:null,“alternate”:“”,“borrowed”:“”,“isRest”:false,“recordingEndBeat”:null},{“root”:1,“beat”:29,“duration”:4,“type”:5,“inversion”:0,“applied”:0,“adds”:[],“omits”:[],“alterations”:[],“suspensions”:[],“pedal”:null,“alternate”:“”,“borrowed”:“”,“isRest”:false,“recordingEndBeat”:null}],“fp”:“f8389b1012cf0105bdf69df7777b5cb73686b4a3”}

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 2662

Trending Articles