Here is a sample song in text format:
//
z:\CSE467\midi0\aria.mid
mthd
version 0 // single multichanneltrack
// 1 track
unit 192 // is 1/4
end mthd
mtrk // multichannel track // track 1
/* U0 */ /* 0ms */ tact
4 / 4 24 8
/* U0 */ /* 0ms */
beats 35.00001 /* 1714285 microsec/beat */
/* U0 */ /* 0ms */ key
"Cmaj"
/* U0 */ /* 0ms */
[1]+d3 $5A;
/* U0 */ /* 0ms */
[2]+a4 $5A;
/* U0 */ /* 0ms */
[3]+d5 $5A;
/* U0 */ /* 0ms */
[4]+f#5 $5A;
1/8; /* U96 */ /* 857ms */ [1]-d3
$40;
/* U96 */ /* 857ms */
+d4 $5A;
1/8; /* U192 */ /* 1714ms */ -d4
$40;
/* U192 */ /* 1714ms */
+c#4 $5A;
1/8; /* U288 */ /* 2571ms */ -c#4
$40;
/* U288 */ /* 2571ms */
+c#3 $5A;
1/8; /* U384 */ /* 3428ms */ -c#3
$40;
/* U384 */ /* 3428ms */
+b2 $5A;
/* U384 */ /* 3428ms */
[2]-a4 $40;
/* U384 */ /* 3428ms */
+b4 $5A;
1/8; /* U480 */ /* 4285ms */
[1]-b2 $40;
/* U480 */ /* 4285ms */
+b3 $5A;
1/8; /* U576 */ /* 5142ms */ -b3
$40;
/* U576 */ /* 5142ms */
+a3 $5A;
1/8; /* U672 */ /* 5999ms */ -a3
$40;
Comments are inside /* ... */ or start with // till end of line.
Pauses are shown before commands either in MIDI units ( 47; )or musical notation ( 536/4; ).
MIDI notes consists of pairs of commands: Note on is displayed as + and Note off is displayed as -
MIDI channel are displayed in mtrk(channel number) or as [channel number] inside a track before a command.
Values are shown decimal (0-127) or hexadecimal ($00 - $7F).
Standard MIDI file format is here.
Construct a new program for the Microblaze that plays the song of your choice triggered by a keypress.