According to this there are only 14 combinations and two scales, what about the others?
Carlos, be aware your count is off by one. A MIDI file Key Signature Meta Event can represent
15 visually unique key signatures (1 to 7 sharps + 1 to 7 flats + no sharps or flats)
× 2 tonalities (major or minor)
= 30
uniquely named keys in total
But you are correct, the other possible values for those bytes have no defined meaning, and a Key Signature Meta Event can only represent those 30 keys. So, for example, a Key Signature Meta Event can't represent
• keys like
D-flat minor ("8" flats), you have to settle for the enharmonically equivalent C-sharp minor (4 sharps)
• modes like the
modern Dorian mode from D to D.
(Also note, a one-byte signed value can represent values from
-128 to +127.)
The parameters are 7-bit, which means they can only have 128 unique values, not 256.
Eddie Lotter: Remember that Meta Events -- FF <type> <length> <bytes> -- do not get sent out on the MIDI port, they only exist inside the MIDI file for the MIDI file software to see.
• The data <bytes> of a Meta Event can generally use any byte value decimal 0 to 255 (hex 00 to FF).
• The specification says the <type> number that indicates the type of Meta Event is limited to 0 to 127, however.
• (And, of course, as you know, the <length> is a variable-length quantity, so it can use values decimal 128 to 255 (hex 80 to FF) to enlarge the length of the quantity. But everyone tends to remember that variable-length quantities don't get sent out on a MIDI port and they can use all 8 bits of a byte when needed.)
As Geoff mentioned, in a Key Signature Meta Event, the values of -1 down to -7 mentioned in the specification are represented in two's complement form as decimal 255 down to 249 (hex FF down to F9). So as Carlos mentioned, the first data byte of a Key Signature Meta Event could possibly represent values of -128 to +127 if every possible value were allowed. And the second data byte of a Key Signature Meta Event could possibly represent values of 0 to 255 if every possible value were allowed. But the specification only defines meanings for -7 to +7 and for 0 to 1.
A previous example of Meta Event data bytes using all 8 bits of a byte: In the example Tempo Meta Event shown at the end of the MIDI File Specification document, FF 51 03 07 A1 20 (which represents 120 quarter notes per minute or 500,000 microseconds per quarter note in big-endian hex: 07A120), the A1 byte is possible because
the data bytes of a Meta Event can use all 8 bits of a byte.