fbpx
Skip to main content

MIDI Forum

Time Signature Unde...
 
Notifications
Clear all

Time Signature Understanding

6 Posts
3 Users
0 Reactions
12 K Views
Steve
Posts: 6
Active Member
Topic starter
 

I'm writing my own software to use the built-in Microsoft MIDI Synthesizer. I've been agonizing over the Time Signature Meta-Event. And, from my searches in this forum and on the internet there is a lot of confusion about the cc value of the sequence: FF 58 04 nn dd cc bb

The spec says, "The cc parameter expresses the number of MIDI clocks in a metronome click."
And, provides an example,

Therefore, the complete event for 6/8 time, where the metronome clicks every three
eighth-notes, but there are 24 clocks per quarter-note, 72 to the bar, would be (in hex):
FF 58 04 06 03 24 08
That is, 6/8 time (8 is 2 to the 3rd power, so this is 06 03), 36 MIDI clocks per dotted quarter (24 hex!), and eight notated 32nd-notes per MIDI quarter note.

It's the part about the "dotted quarter" that lit up my understanding. Then I remembered playing saxophone in High School and one of the music sheets used a dotted quarter note to specify the Tempo of a 6/8 measure. So, I checked the internet and found some examples...I'm attaching one of them. So, apparently the cc value is ONLY used when the Tempo is being displayed as a dotted quarter note as is sometimes used for 6/8 time.

But, now that I understand how cc is used my concern now is that it's only one byte while the format 0 file Division can be 15 bits as the spec says, "If bit 15 of is a zero, the bits 14 thru 0 represent the number of delta-time "ticks" which make up a quarter-note." My research indicates that at the time of the writing of the MIDI specs the default for division was 48 or if better resolution was desired it could be increased to 96 as in the example, "For instance, if is 96, then a time interval of an
eighth-note between two events in the file would be 48." However, the speed of digital systems has increased to where even a division of 0x4000 (16384 clock ticks per quarter note) can be supported. However, if the time signature is 6/8 and it is desired to display and use a metronome for dotted quarter notes then we will be limited to a division of something like 168 ticks per quarter note so that the cc value would be 168 + 84 = 252 (0xFC).

So, my question is...is there an existing Meta-Event which we can use to provide the metronome time signature for dotted quarter notes with more than 1 byte? If not then is there an unused Meta-Event Code that we can use to provide an expanded Time Signature event that allows 3 bytes or a variable-length quantity for the number of ticks for a dotted quarter note metronome?

 
Posted : 13/12/2021 9:35 am
Bavi_H
Posts: 266
Reputable Member
 

Note: a MIDI clock is a different than than a MIDI file tick.

A MIDI Clock is the F8 message that can optionally be sent on a MIDI cable. When clock messages are used, they are sent 24 times per quarter note.

A MIDI file tick is the unit of time in a MIDI file -- the units used in the "delta times" before each event in the MIDI file. the meaning of the tick values is specified by the division value in the header. Almost always, a MIDI file will use the "ticks per quarter note" type of division.

In the Time Signature Meta Event, the cc value is always in units of MIDI clocks -- in other words, units of 1/24 of a quarter note -- no matter what the division value of the MIDI file is.

 
Posted : 13/12/2021 10:35 am
Pedro Lopez-Cabanillas
Posts: 154
Estimable Member
 

About the Division field of the SMF header: the largest integer number that can be represented with 15 bits is 7FFF hex, 32767 decimal. This is an absurdly high resolution that I've never seen in the wild. My first software sequencer, running under MS-DOS, was Cakewalk 1.0 which had a default resolution of 120. This was a very good choice for a default at the time (90s of the last century). The highest division value that I've ever found is 960, which means that 1 tick is almost equal to 1.92 milliseconds when tempo is 120 QPM. It does not matter too much for the time signature meta event, as @Bavi_H explains.

But anyway, if you are simply trying to play a SMF the time signature meta event doesn't matter. It does not produce any change on the musical sound. It only matters if you are trying to represent the SMF as a musical score.

 
Posted : 13/12/2021 10:43 am
Steve
Posts: 6
Active Member
Topic starter
 

[quotePost id=12693]Note: a MIDI clock is a different than than a MIDI file tick.

A MIDI Clock is the F8 message that can optionally be sent on a MIDI cable. When clock messages are used, they are sent 24 times per quarter note.

A MIDI file tick is the unit of time in a MIDI file -- the units used in the "delta times" before each event in the MIDI file. the meaning of the tick values is specified by the division value in the header. Almost always, a MIDI file will use the "ticks per quarter note" type of division.

In the Time Signature Meta Event, the cc value is always in units of MIDI clocks -- in other words, units of 1/24 of a quarter note -- no matter what the division value of the MIDI file is.
[/quotePost]
First...thanks to everyone for answering...it's really appreciated especially since I am so confused and saying crazy things and asking questions that to you all must have obvious answers.

Eureka! OK...it's starting to make sense now. I don't think the specs say explicitly that the MIDI Clock is fixed at 24 ticks per quarter note...I guess it's something that the writers of the specs took for granted that their readers would already know. So, if I want the Metronome to click on every quarter note then I simply set the cc value to 24 regardless of the Tempo or Division?

 
Posted : 15/12/2021 1:38 am
Bavi_H
Posts: 266
Reputable Member
 

[quotePost id=12732]I don't think the specs say explicitly that the MIDI Clock is fixed at 24 [clocks] per quarter note...[/quotePost] The MIDI Clock message is specified in the MIDI 1.0 specification -- the spec about MIDI messages you can send on a MIDI cable. See PDF page 35 (printed page 30), "TIMING CLOCK: Clock-based MIDI systems are synchronized with this message, which is sent at a rate of 24 per quarter note."

[quotePost id=12732]So, if I want the Metronome to click on every quarter note then I simply set the cc value to 24 regardless of the Tempo or Division?[/quotePost] Yes: a cc value of decimal 24 means click the metronome every quarter note.

However, the MIDI software I've used ignores the cc value and always clicks the metronome according to the denominator of the time signature. For example, a Time Signature of 6/8 with a cc value of decimal 36 and a bb value of 8 is supposed to click the metronome every dotted quarter note per the spec, but MIDI software I've used clicks the metronome every eighth note.

P.S. Although you didn't ask about the bb value, you can read about it in previous thread SMF time signature confusion, or ask more about it here.

 
Posted : 15/12/2021 2:54 am
Pedro Lopez-Cabanillas
Posts: 154
Estimable Member
 

So, if I want the Metronome to click on every quarter note then I simply set the cc value to 24 regardless of the Tempo or Division?

Most SMF players will ignore time signature messages. If you are writing your own sequencer software, then you need to generate the percussion notes yourself, if you want to produce an audible metronome. In that case, you may choose to use the time signature values or anything else.

 
Posted : 15/12/2021 3:30 am
Share: