fbpx
  Friday, 08 July 2022
  6 Replies
  4.9K Visits
14
Votes
Undo
  Subscribe
FF 59 02 sf mi Key Signature
sf = -7: 7 flats
sf = -1: 1 flat
sf = 0: key of C
sf = 1: 1 sharp
sf = 7: 7 sharps

mi = 0: major key
mi = 1: minor key


According to this there are only 14 combinations and two scales, what about the others? because this meta event could go from -127 to 127 for the first parameter and 255 for the second.
4 months ago
·
#15040
0
Votes
Undo
The parameters are 7-bit, which means they can only have 128 unique values, not 256.

Please give an example of a key signature that is not represented and how many sharps or flats are in your example.
4 months ago
·
#15041
1
Votes
Undo
No, you can have all the key signatures available, both Major and minor.

There follows an example from XGworks.

keysigs.jpg

So the first field goes from 00 to 07 then from FF to F9.
The second field can be either 0 (Major) or 1 (minor)
So 00 00 is C Major and 00 01 is A minor.

Any help?
JohnG.
4 months ago
·
#15042
1
Votes
Undo
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.
4 months ago
·
#15043
0
Votes
Undo
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.

You are correct. Thanks for the reminder. I was indeed thinking of messages that go across the wire. :p
4 months ago
·
#15045
0
Votes
Undo
The Standard MIDI File Working Group is currently defining file specifications to support MIDI 2.0 (or more specifically the Universal MIDI Packet format which supports MIDI 1.0 Protocol and MIDI 2.0 Protocol). We have been discussing Key Signatures expanding from Major and Minor to support Ionian, Dorian, Phrygian, Lydian, Mixolydian, Aeolian and Locrian modes by declaring the number of sharps or flats separately from declaring the tonic note value. We are also making this and other formerly "Meta Events" into MIDI 2.0 messages so they can be sent between devices. Developers who have interest can have input to the new specifications by joining as full members of the MIDI Association here: https://midi.activehosted.com/f/26

Thanks,
Mike.
Chairman of MIDI 2.0 Working Group
4 months ago
·
#15046
0
Votes
Undo

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.)


Thanks, I thought that the others could be missing (I don't know how an answer is accepted) if they had only thought of these 30 combinations, they would be enough with a single byte.

Is -128 per 1000 0000? she had not thought about it, not even that it was negative zero :D
Carlos marked this post as Resolved — 4 months ago
Carlos marked this post as Unresolved — 4 months ago
  • Page :
  • 1
There are no replies made for this post yet.