299 lines
13 KiB
Plaintext
299 lines
13 KiB
Plaintext
|
||
MUS File Format
|
||
<E38080>
|
||
|
||
Written by Vladimir Arnost, QA-Software
|
||
Date: Oct 29, 1994
|
||
Internet: xarnos00@dcse.fee.vutbr.cz
|
||
|
||
|
||
1. General Description
|
||
帋帋帋帋帋帋帋帋帋帋帋
|
||
|
||
A .MUS file is a simple clone of .MID file. It uses the same instruments,
|
||
similar commands and the same principle: a list of sound events.
|
||
It consists of two parts: header and body.
|
||
|
||
|
||
2. MUS File Header
|
||
帋帋帋帋帋帋帋帋帋
|
||
|
||
The MUS header has the following structure:
|
||
|
||
struct MUSheader {
|
||
char ID[4]; // identifier "MUS" 0x1A
|
||
WORD scoreLen;
|
||
WORD scoreStart;
|
||
WORD channels;
|
||
WORD dummy1;
|
||
WORD instrCnt;
|
||
WORD dummy2;
|
||
// variable-length part starts here
|
||
WORD instruments[];
|
||
};
|
||
|
||
NOTE: WORD is a 16-bit unsigned integer (little-endian)
|
||
|
||
The header has two parts: the fixed-length and the variable-length parts.
|
||
The former contains file identifier, score start and length, number of
|
||
channels and number of used instruments. The latter part is actually
|
||
a list of used instruments. The instruments are stored as numbers which
|
||
are arranged in this fashion:
|
||
|
||
Instrument Number Meaning
|
||
0 - 127 standard MIDI instruments
|
||
135 - 181 standard MIDI percussions (notes 35 - 81)
|
||
|
||
scoreStart is the absolute file position of the score and scoreLen is its
|
||
length in bytes. Use of 16-bit number as length limits .MUS file size to
|
||
64KB.
|
||
|
||
channels tells you how many channels are utilized in the song. The channel
|
||
number 15 (percussions) is not included in the sum.
|
||
|
||
|
||
3. MUS File Body
|
||
帋帋帋帋帋帋帋帋
|
||
|
||
Unlike MID files, MUS body contains only one track. File body is
|
||
a sequence of sound events and time records. A sound event consists of
|
||
one or more bytes encoded as follows:
|
||
|
||
1st byte -- event descriptor:
|
||
檸<>7巸帋6巸帋5巸帋4巸帋3巸帋2巸帋1巸帋0廀
|
||
<20>ast3 Event type 3 Channel number <20>
|
||
<20>帋帬帋帋爭帋帬帋帋爭帋帬帋帋爭帋帬帋帋<E5B88B>
|
||
|
||
'Event type' is one of these:
|
||
0 - release note
|
||
1 - play note
|
||
2 - pitch wheel
|
||
3 - tempo ???
|
||
4 - change controller
|
||
5 - ???
|
||
6 - score end
|
||
7 - ???
|
||
|
||
'Channel number' determines which channel this event refers to.
|
||
|
||
'Last' - if set, the event is followed by time information. This
|
||
means that this is the last event in a group of events which
|
||
occur at the same time. The time information is a number of
|
||
ticks to wait before processing next event. One tick is usually
|
||
1/128 sec (Raptor uses 1/64 sec).
|
||
|
||
Time information can be read in this way:
|
||
1. time = 0
|
||
2. read a byte
|
||
3. time = time * 128 + byte AND 127
|
||
4. if (byte AND 128) go to 2
|
||
5. return time
|
||
The time info is a series of 7-bit chunks. The 8th bit is set
|
||
until the last byte whose 8th bit is zero. This scheme allows
|
||
small numbers occupy less space than large ones.
|
||
|
||
Event Type
|
||
帋帋帋帋帋帋帋帋帋帋
|
||
0 Release note
|
||
檸7巸<37>6巸<36>5巸<35>4巸<34>3巸<33>2巸<32>1巸<31>0廀
|
||
<20> 0 3 Note number 0 - 127 <20>
|
||
<20>帋爭帋爭帋爭帋爭帋爭帋爭帋爭帋<E788AD>
|
||
|
||
1 Play note
|
||
檸7巸<37>6巸<36>5巸<35>4巸<34>3巸<33>2巸<32>1巸<31>0廀 檸7巸<37>6巸<36>5巸<35>4巸<34>3巸<33>2巸<32>1巸<31>0廀
|
||
<20>ol3 Note number 0 - 127 <20> <20> 0 3 Note volume 0 - 127 <20>
|
||
<20>帋爭帋爭帋爭帋爭帋爭帋爭帋爭帋<E788AD> <20>帋爭帋爭帋爭帋爭帋爭帋爭帋爭帋<E788AD>
|
||
|
||
Note volume is present only if 'Vol' is set. Otherwise the previous
|
||
value is used and the second byte is not present.
|
||
NOTE: Each channel keeps track of its own last volume value.
|
||
More than one note can be played at once in one channel.
|
||
Channel 15 is dedicated to drums and percussions. Note number acts
|
||
as an instrument selector there. see Appendix C
|
||
|
||
2 Pitch wheel
|
||
檸7巸<37>6巸<36>5巸<35>4巸<34>3巸<33>2巸<32>1巸<31>0廀
|
||
<20> Pitch wheel value <20>
|
||
<20>帋爭帋爭帋爭帋爭帋爭帋爭帋爭帋<E788AD>
|
||
|
||
Sets pitch wheel (bender) value of a channel. Some handy values are
|
||
shown in the table (all values in the range 0-255 can be used):
|
||
|
||
<20>帋帋儙帋帋帋帋帋帋帋帋帋帋帋<E5B88B>
|
||
3Value3 Pitch change 3
|
||
~A帋帋帍帋帋帋帋帋帋帋帋帋帋帋<E5B88B>'
|
||
3 0 3 two half-tones down 3
|
||
3 64 3 one half-tone down 3
|
||
3 128 3 normal (default) 3
|
||
3 192 3 one half-tone up 3
|
||
3 255 3 two half-tones up 3
|
||
厧帋帋爭帋帋帋帋帋帋帋帋帋帋帋<E5B88B>
|
||
|
||
3 Unknown (set tempo???)
|
||
檸7巸<37>6巸<36>5巸<35>4巸<34>3巸<33>2巸<32>1巸<31>0廀
|
||
<20> Unknown value <20>
|
||
<20>帋爭帋爭帋爭帋爭帋爭帋爭帋爭帋<E788AD>
|
||
|
||
4 Change control
|
||
檸7巸<37>6巸<36>5巸<35>4巸<34>3巸<33>2巸<32>1巸<31>0廀 檸7巸<37>6巸<36>5巸<35>4巸<34>3巸<33>2巸<32>1巸<31>0廀
|
||
<20> 0 3 Controller number <20> <20> 0 3 Controller value <20>
|
||
<20>帋爭帋爭帋爭帋爭帋爭帋爭帋爭帋<E788AD> <20>帋爭帋爭帋爭帋爭帋爭帋爭帋爭帋<E788AD>
|
||
|
||
Number Description
|
||
0 Instrument (patch) number
|
||
3 Volume: 0-silent, ~100-normal, 127-loud
|
||
4 Pan (balance): 0-left, 64-center (default), 127-right
|
||
|
||
No other controller's functions are known to me.
|
||
|
||
5 Unknown
|
||
Not known what data (if any) this command takes.
|
||
|
||
6 Score end
|
||
No data.
|
||
|
||
Marks the end of score. Must be present at the end, otherwise the
|
||
player may go off the rail. In DOOM this command restarts playing.
|
||
|
||
7 Unknown
|
||
Not known what data (if any) this command takes.
|
||
|
||
|
||
APPENDIX A - Note numbers
|
||
帋帋帋帋帋帋帋帋帋帋帋帋<EFBFBD>
|
||
|
||
悺 <E38080> ˉ ァ ˉ ァ ˉ ァ ˉ ァ ˉ ァ ˉ <E38080>
|
||
<20> Octave <20> C 3 C# 3 D 3 D# 3 E 3 F 3 F# 3 G 3 G# 3 A 3 A# 3 B <20>
|
||
崱 <E38080> № 怼 № 怼 № 怼 № 怼 № 怼 № 1
|
||
<20> 0 <20> 0 3 1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 3 9 3 10 3 11 <20>
|
||
<20> 1 <20> 12 3 13 3 14 3 15 3 16 3 17 3 18 3 19 3 20 3 21 3 22 3 23 <20>
|
||
<20> 2 <20> 24 3 25 3 26 3 27 3 28 3 29 3 30 3 31 3 32 3 33 3 34 3 35 <20>
|
||
<20> 3 <20> 36 3 37 3 38 3 39 3 40 3 41 3 42 3 43 3 44 3 45 3 46 3 47 <20>
|
||
<20> 4 <20> 48 3 49 3 50 3 51 3 52 3 53 3 54 3 55 3 56 3 57 3 58 3 59 <20>
|
||
<20> 5 <20> 60 3 61 3 62 3 63 3 64 3 65 3 66 3 67 3 68 3 69 3 70 3 71 <20>
|
||
<20> 6 <20> 72 3 73 3 74 3 75 3 76 3 77 3 78 3 79 3 80 3 81 3 82 3 83 <20>
|
||
<20> 7 <20> 84 3 85 3 86 3 87 3 88 3 89 3 90 3 91 3 92 3 93 3 94 3 95 <20>
|
||
<20> 8 <20> 96 3 97 3 98 3 99 3100 3101 3102 3103 3104 3105 3106 3107 <20>
|
||
<20> 9 <20> 108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 <20>
|
||
<20> 10 <20> 120 3121 3122 3123 3124 3125 3126 3127 3 3 3 3 <20>
|
||
姟 <E38080> <E38080> 嫛 <E5AB9B> 嫛 <E5AB9B> 嫛 <E5AB9B> 嫛 <E5AB9B> 嫛 <E5AB9B> <E38080>
|
||
|
||
|
||
APPENDIX B - Instrument Patch Map
|
||
帋帋帋帋帋帋帋帋帋帋帋帋帋帋帋帋<EFBFBD>
|
||
|
||
Block 0-7 PIANO Block 8-15 CHROM PERCUSSION
|
||
0 Acoustic Grand Piano 8 Celesta
|
||
1 Bright Acoustic Piano 9 Glockenspiel
|
||
2 Electric Grand Piano 10 Music Box
|
||
3 Honky-tonk Piano 11 Vibraphone
|
||
4 Rhodes Paino 12 Marimba
|
||
5 Chorused Piano 13 Xylophone
|
||
6 Harpsichord 14 Tubular-bell
|
||
7 Clavinet 15 Dulcimer
|
||
|
||
Block 16-23 ORGAN Block 24-31 GUITAR
|
||
16 Hammond Organ 24 Acoustic Guitar (nylon)
|
||
17 Percussive Organ 25 Acoustic Guitar (steel)
|
||
18 Rock Organ 26 Electric Guitar (jazz)
|
||
19 Church Organ 27 Electric Guitar (clean)
|
||
20 Reed Organ 28 Electric Guitar (muted)
|
||
21 Accordion 29 Overdriven Guitar
|
||
22 Harmonica 30 Distortion Guitar
|
||
23 Tango Accordion 31 Guitar Harmonics
|
||
|
||
Block 32-39 BASS Block 40-47 STRINGS
|
||
32 Acoustic Bass 40 Violin
|
||
33 Electric Bass (finger) 41 Viola
|
||
34 Electric Bass (pick) 42 Cello
|
||
35 Fretless Bass 43 Contrabass
|
||
36 Slap Bass 1 44 Tremolo Strings
|
||
37 Slap Bass 2 45 Pizzicato Strings
|
||
38 Synth Bass 1 46 Orchestral Harp
|
||
39 Synth Bass 2 47 Timpani
|
||
|
||
Block 48-55 ENSEMBLE Block 56-63 BRASS
|
||
48 String Ensemble 1 56 Trumpet
|
||
49 String Ensemble 2 57 Trombone
|
||
50 Synth Strings 1 58 Tuba
|
||
51 Synth Strings 2 59 Muted Trumpet
|
||
52 Choir Aahs 60 French Horn
|
||
53 Voice Oohs 61 Brass Section
|
||
54 Synth Voice 62 Synth Brass 1
|
||
55 Orchestra Hit 63 Synth Bass 2
|
||
|
||
Block 64-71 REED Block 72-79 PIPE
|
||
64 Soprano Sax 72 Piccolo
|
||
65 Alto Sax 73 Flute
|
||
66 Tenor Sax 74 Recorder
|
||
67 Baritone Sax 75 Pan Flute
|
||
68 Oboe 76 Bottle Blow
|
||
69 English Horn 77 Shakuhachi
|
||
70 Bassoon 78 Whistle
|
||
71 Clarinet 79 Ocarina
|
||
|
||
Block 80-87 SYNTH LEAD Block 88-95 SYNTH PAD
|
||
80 Lead 1 (square) 88 Pad 1 (new age)
|
||
81 Lead 2 (sawtooth) 89 Pad 2 (warm)
|
||
82 Lead 3 (calliope) 90 Pad 3 (polysynth)
|
||
83 Lead 4 (chiffer) 91 Pad 4 (choir)
|
||
84 Lead 5 (charang) 92 Pad 5 (bowed glass)
|
||
85 Lead 6 (voice) 93 Pad 6 (metal)
|
||
86 Lead 7 (5th sawtooth) 94 Pad 7 (halo)
|
||
87 Lead 8 (bass & lead) 95 Pad 8 (sweep)
|
||
|
||
Block 96-103 SYNTH EFFECTS Block 104-111 ETHNIC
|
||
96 FX 1 (rain) 104 Sitar
|
||
97 FX 2 (soundtrack) 105 Banjo
|
||
98 FX 3 (crystal) 106 Shamisen
|
||
99 FX 4 (atmosphere) 107 Koto
|
||
100 FX 5 (brightness) 108 Kalimba
|
||
101 FX 6 (goblin) 109 Bag Pipe
|
||
102 FX 7 (echo drops) 110 Fiddle
|
||
103 FX 8 (star-theme) 111 Shanai
|
||
|
||
Block 112-119 PERCUSSIVE Block 120-127 SOUND EFFECTS
|
||
112 Tinkle Bell 120 Guitar Fret Noise
|
||
113 Agogo 121 Breath Noise
|
||
114 Steel Drums 122 Seashore
|
||
115 Woodblock 123 Bird Tweet
|
||
116 Taiko Drum 124 Telephone Ring
|
||
117 Melodic Tom 125 Helicopter
|
||
118 Synth Drum 126 Applause
|
||
119 Reverse Cymbal 127 Gun Shot
|
||
|
||
|
||
APPENDIX C - Percussion Key Map
|
||
帋帋帋帋帋帋帋帋帋帋帋帋帋帋帋<EFBFBD>
|
||
|
||
In channel #15, the note number does not affect the pitch but
|
||
the instrument type. The default pitch for percussions is 60 (C-5).
|
||
|
||
Note Instrument Note Instrument
|
||
|
||
35 Acoustic Bass Drum 59 Ride Cymbal 2
|
||
36 Bass Drum 60 High Bongo
|
||
37 Slide Stick 61 Low Bango
|
||
38 Acoustic Snare 62 Mute High Conga
|
||
39 Hand Clap 63 Open High Conga
|
||
40 Electric Snare 64 Low Conga
|
||
41 Low Floor Tom 65 High Timbale
|
||
42 Closed High-Hat 66 Low Timbale
|
||
43 High Floor Tom 67 High Agogo
|
||
44 Pedal High Hat 68 Low Agogo
|
||
45 Low Tom 69 Cabasa
|
||
46 Open High Hat 70 Maracas
|
||
47 Low-Mid Tom 71 Short Whistle
|
||
48 High-Mid Tom 72 Long Whistle
|
||
49 Crash Cymbal 1 73 Short Guiro
|
||
50 High Tom 74 Long Guiro
|
||
51 Ride Cymbal 1 75 Claves
|
||
52 Chinses Cymbal 76 High Wood Block
|
||
53 Ride Bell 77 Low Wood Block
|
||
54 Tambourine 78 Mute Cuica
|
||
55 Splash Cymbal 79 Open Cuica
|
||
56 Cowbell 80 Mute Triangle
|
||
57 Crash Cymbal 2 81 Open Triangle
|
||
58 Vibraslap
|
||
|