MIDI Key Signature meta message

The MIDI key signature meta message specifies the key signature and scale of a MIDI file.

This message belongs to the category of MIDI meta messages. Since this is a meta message the MIDI event that carries this message may exist in MIDI files, but it is not sent over MIDI ports to a MIDI device.

This message consists of five bytes of data. The first byte is the status byte 0xFF, which shows that this is a meta message. The second byte is the meta message type 0x59, which shows that this is the key signature meta message. The third byte is 0x02, which shows that there are two remaining bytes. The fourth byte has values between -7 and 7 and specifies the key signature in terms of number of flats (if negative) or sharps (if positive). The fifth and last byte of the message specifies the scale of the MIDI file, where if this byte is 0 the scale is major and if the byte is 1 the scale is minor.

The following is an example of a key signature meta message.

0xFF 0x59 0x02 0x04 0x00

The status byte is 0xFF, which shows that this is a meta message. The meta message type is 0x59, which shows that this is the key signature meta message. The third byte is 2, which shows that there are two remaining bytes. The fourth byte 0x04 signifies four sharps and the last byte signifies that this is a major key. Thus, this message specifies that the MIDI file is in the key of E major (the major scale in E is E, F#, G#, A, B, C#, D# and has four sharps).

If there is no events with the key signature message, C major is assumed, which is equivalent to the message 0xFF 0x59 0x02 0x00 0x00.

The following is an example of the number of flats and sharps in the major scales. Each row is a different major scale and the first column contains the root notes of each of these scales.

Cb Db Eb Fb Gb Ab Bb 7 flats
Gb Ab Bb Cb Db Eb F 6 flats
Db Eb F Gb Ab Bb C 5 flats
Ab Bb C Db Eb F G 4 flats
Eb F G Ab Bb C D 3 flats
Bb C D Eb F G A 2 flats
F G A Bb C D E 1 flat
C D E F G A B no flats or sharps
G A B C D E F# 1 sharp
D E F# G A B C# 2 sharps
A B C# D E F# G# 3 sharps
E F# G# A B C# D# 4 sharps
B C# D# E F# G# A# 5 sharps
F# G# A# B C# D# E# 6 sharps
C# D# E# F# G# A# B# 7 sharps

The flats and sharps in the minor scales are as follows.

Ab Bb Cb Db Eb Fb Gb 7 flats
Eb F Gb Ab Bb Cb Db 6 flats
Bb C Db Eb F Gb Ab 5 flats
F G Ab Bb C Db Eb 4 flats
C D Eb F G Ab Bb 3 flats
G A Bb C D Eb F 2 flats
D E F G A Bb C 1 flat
A B C D E F G no flats or sharps
E F# G A B C D 1 sharp
B C# D E F# G A 2 sharps
F# G# A B C# D E 3 sharps
C# D# E F# G# A B 4 sharps
G# A# B C# D# E F# 5 sharps
D# E# F# G# A# B C# 6 sharps
A# B# C# D# E# F# G# 7 sharps

See also:
Musical Instrument Digital Interface (MIDI)

Add new comment

Filtered HTML

  • Freelinking helps you easily create HTML links. Links take the form of [[indicator:target|Title]]. By default (no indicator): Click to view a local node.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.