The first chunk in every SMF is called the header track. They are rows 10-11 in the SMFTemplate. Row 10 begins with a semicolon and is a comment. It provides a consise description of the MThd format. Line 10 indicates that the SMF header has five componenets:
The values of these five items will be entered in row 11. The ID, Length, and SMF Type are prefilled with the correct values.
You'll need to fill in the two remaining yellow cells in row 11.
The ( h ) and ( d ) directly above the yellow cells in row 10 indicate whether the number format is Hex or Decimal.
All tracks after the header chunk uses the ID marker MTrk to indicate the beginning of a track chunk. This is followed immediately by four bytes that indicate the length of the data to follow. Track 1 is a special track often called the Tempo Track or Conductor Track and uses meta events to provide general song information.
This is the Track 1 section from the SMF tab.
The first 4 bytes of a track chunk are MTrk. The second four bytes indicates the number of data bytes to follow. The track length is set to 0. MIDIDisplay will calculate the actual length for you. The MTrk header is already filled in.
The remainder of track 1 consists of meta-events.
The MIDI Manufacturer's Association defined a series of events called meta events to represent information like time signature, key signature, tempo, copyright, instrument track names, text, etc.
All meta events follow this format: FF cc nn dd
You'll be always use these four Meta Events in Track 1.
Important: A Delta Time (PPQ value) precedes every meta event and MIDI message. Delta times are in column A.
Your midterm project must include a meta-event for the key signature.
The format for the Key Signature meta event is:
The two data bytes are documented as sf and mi.
sf represents the number of sharps and flats in the key signature as shown in the following table. Sharps are numbered from 1 - 7, while flats are numbered negative 1 - 7. A standard convention in computer counting is that negative numbers count backwards from FF.
Number Sharps Flats | Hex Code |
7 sharps | 7 |
6 sharps | 6 |
5 sharps | 5 |
4 sharps | 4 |
3 sharps | 3 |
2 sharps | 2 |
1 sharp | 1 |
0 sharps or flats | 0 |
1 flat | FF |
2 flats | FE |
3 flats | FD |
4 flats | FC |
5 flats | FB |
6 flats | FA |
7 flats | F9 |
mi indicates whether the song is in a major or minor key. Use one for a minor key and zero for a major key.
Going For Baroque is in the key of C minor. You'll need to fill in this is the data:
Note: The comment in row 17 says all numbers must be in hex.
Your midterm project must include a meta-event for the time signature.
The format for the Time Signature meta event is:
nn the upper number of the time signature.
dd the lower number of the key signature expressed as a power of two.
cc the number of MIDI clocks ($F8) per quarter note. MIDI clocks were an early attempt to synchronize multiple MIDI synthesizers. It is not that accurate. Better synchronization methods are used today. However, the SMF still requires an entry. The cc value in simple time is $18 (24 decimal). In compound time it is $24 (36 decimal).
bb the number of notated thirty second notes in a quarter note (8 is the standard value).
Going For Baroque has a time signature of three four. This is the information you need to fill in.
The completed time signature meta event is.
Note: The comment in row 20 says all numbers must be in hex.
The Tempo meta event is:
The tempo of Going for Baroque is 100 beats per minute.
The microsecond duration of one quarter note at a tempo of 100 bpm is 60,000,000/100 = 600,00 μs. Convert 600,000 to hex.
You want to use a tempo of 60. Type this into the Google search bar "1000000*60/100 in hex" and you'll get 0x927C0. The 0x prefix is common way of indicating hexadecimal numbers.
Try this Excel formula in an empty cell: =DEC2HEX(1000000*60/100). If the DEC2HEX function is installed you'll get 927C0.
Use the Apple Calculator found in the /Applications folder. Choose Programmer from the View menu. The shortcut is Apple-3. Enter 600000 in base 10 and then click base 16. You'll get 927c0 as the answer.
![]() |
![]() |
Split the hex number into three parts 9 27 c0. This is the information you need to fill in:
The completed tempo meta event is:
Every track ends with the End of Track meta event. It is filled in for you.
Continue with 05Lab5.
Revised John Ellinger, January - September 2013