Blue
Red
Green
Orange
Voilet
Slate
Dark

********* 200分寻 MIDI 文件格式 *****************(200分)

  • 主题发起人 YaoChangLi
  • 开始时间
Y

YaoChangLi

Unregistered / Unconfirmed
GUEST, unregistred user!
谁知道MIDI文件的格式,有急用!!!!!!!!!!!!!!
 
C

cmldy

Unregistered / Unconfirmed
GUEST, unregistred user!
摘自CSDN
standard midi file format

dustin caldwell

the standard midi file format is a very strange beast. when viewed as a
whole, it can be quite overwhelming. of course, no matter how you look at it,
describing a piece of music in enough detail to be able to reproduce it
accurately is no small task. so, while complicated, the structure of the midi
file format is fairly intuitive when understood.
i must insert a disclaimer here that i am by no means an expert with
midi nor midi files. i recently obtained a gravis ultrasound board for my pc,
and upon hearing a few midi files (.mid) thought, "gee, i'd like to be able to
make my own .mid files." well, many aggravating hours later, i discovered that
this was no trivial task. but, i couldn't let a stupid file format stop me.
(besides, i once told my wife that computers aren't really that hard to use,
and i'd hate to be a hypocrite) so if any errors are found in this
information, please let me know and i will fix it. also, thisdo
cument's scope
does not extend to every type of midi command and every possible file
configuration. it is a basic guide that should enable the reader (with a
moderate investment in time) to generate a quality midi file.

1. overview

a midi (.mid) file contains basically 2 things, header chunks and track
chunks. section 2 explains the header chunks, and section 3 explains the track
chunks. a midi file contains one header chunk describing the file format,
etc., and any number of track chunks. a track may be thought of in the same
way as a track on a multi-track tape deck. you may assign one track to each
voice, each staff, each instrument or whatever you want.

2. header chunk

the header chunk appears at the begin
ning of the file, and describes the
file in three ways. the header chunk always looks like:

4d 54 68 64 00 00 00 06 ff ff nn nn dd dd

the ascii equivalent of the first 4 bytes is mthd. after mthd comes the 4-byte
size of the header. this will always be 00 00 00 06, because the actual header
information will always be 6 bytes.

ff ff is the file format. there are 3 formats:

0 - single-track
1 - multiple tracks, synchronous
2 - multiple tracks, asynchronous

single track is fairly self-explanatory - one track only. synchronous multiple
tracks means that the tracks will all be vertically synchronous, or in other
words, they all start at the same time, and so can represent different parts
in one song. asynchronous multiple tracksdo
not necessarily start at the same
time, and can be completely asynchronous.

nn nn is the number of tracks in the midi file.

dd dd is the number of delta-time ticks per quarter note. (more about this
later)


3. track chunks

the remainder of the file after the header chunk consists of track chunks.
each track has one header and may contain as many midi commands as you like.
the header for a track is very similar to the one for the file:

4d 54 72 6b xx xx xx xx

as with the header, the first 4 bytes has an ascii equivalent. this one is
mtrk. the 4 bytes after mtrk give the length of the track (not including the
track header) in bytes.
following the header are midi events. these events are identical to the
actual data sent and received by midi ports on a synth with one addition. a
midi event is preceded by a delta-time. a delta time is the number of ticks
after which the midi event is to be executed. the number of ticks per quarter
note was defined previously in the file header chunk. this delta-time is a
variable-length encoded value. this format, while confusing, allows large
numbers to use as many bytes as they need, without requiring small numbers to
waste bytes by filling with zeros. the number is converted into 7-bit bytes,
and the most-significant bit of each byte is 1 except for the last byte of the
number, which has a msb of 0. this allows the number to be read one byte at a
time, and when you see a msb of 0, you know that it was the last (least
significant) byte of the number. according to the midi spec, the entire delta-
time should be at most 4 bytes long.
following the delta-time is a midi event. each midi event (except a
running midi event) has a command byte which will always have a msb of 1 (the
value will be >= 128). a list of most of these commands is in appendix a. each
command has different parameters and lengths, but the data that follows the
command will have a msb of 0 (less than 128). the exception to this is a meta-
event, which may contain data with a msb of 1. however, meta-events require a
length parameter which alleviates confusion.
one subtlety which can cause confusion is running mode. this is where
the actual midi command is omitted, and the last midi command issued is
assumed. this means that the midi event will consist of a delta-time and the
parameters that would go to the command if it were included.

4. conclusion

if this explanation has only served to confuse the issue more, the
appendices contain examples which may help clarify the issue. also, 2
utilities and a graphic file should have been included with thisdo
cument:

dec.exe - this utility converts a binary file (like .mid) to a tab-delimited
text file containing the decimal equivalents of each byte.

rec.exe - this utility converts a tab-delimited text file of decimal values
into a binary file in which each byte corresponds to one of the decimal
values.

midinote.ps - this is the postscript form of a page showing note numbers with
a keyboard and with the standard grand staff.
appendix a

1. midi event commands

each command byte has 2 parts. the left nybble (4 bits) contains the actual
command, and the right nybble contains the midi channel number on which the
command will be executed. there are 16 midi channels, and 8 midi commands (the
command nybble must have a msb of 1).
in the following table, x indicates the midi channel number. note that all
data bytes will be <128 (msb set to 0).

hex binary data description
8x 1000xxxx nn vv note off (key is released)
nn=note number
vv=velocity

9x 1001xxxx nn vv note on (key is pressed)
nn=note number
vv=velocity

ax 1010xxxx nn vv key after-touch
nn=note number
vv=velocity

bx 1011xxxx cc vv control change
cc=controller number
vv=new value

cx 1100xxxx pp program (patch) change
pp=new program number

dx 1101xxxx cc channel after-touch
cc=channel number

ex 1110xxxx bb tt pitch wheel change (2000h is normal or no
change)
bb=bottom (least sig) 7 bits of value
tt=top (most sig) 7 bits of value
the following table lists meta-events which have no midi channel number. they
are of the format:

ff xx nn dd

all meta-events start with ff followed by the command (xx), the length, or
number of bytes that will contain data (nn), and the actual data (dd).

hex binary data description
00 00000000 nn ssss sets the track's sequence number.
nn=02 (length of 2-byte sequence number)
ssss=sequence number

01 00000001 nn tt .. text event- any text you want.
nn=length in bytes of text
tt=text characters

02 00000010 nn tt .. same as text event, but used for
copyright info.
nn tt=same as text event

03 00000011 nn tt .. sequence or track name
nn tt=same as text event

04 00000100 nn tt .. track instrument name
nn tt=same as text event

05 00000101 nn tt .. lyric
nn tt=same as text event

06 00000110 nn tt .. marker
nn tt=same as text event

07 00000111 nn tt .. cue point
nn tt=same as text event

2f 00101111 00 this event must come at the end of each
track

51 01010001 03 tttttt set tempo
tttttt=microseconds/quarter note

58 01011000 04 nn dd ccbb time signature
nn=numerator of time sig.
dd=denominator of time sig. 2=quarter
3=eighth, etc.
cc=number of ticks in metronome click
bb=number of 32nd notes to the quarter
note

59 01011001 02 sf mi key signature
sf=sharps/flats (-7=7 flats, 0=key of c,
7=7 sharps)
mi=major/minor (0=major, 1=minor)

7f 01111111 xx dd .. sequencer specific information
xx=number of bytes to be sent
dd=data
the following table lists system messages which control the entire system.
these have no midi channel number. (these will generally only apply to
controlling a midi keyboard, etc.)

hex binary data description
f8 11111000 timing clock used when synchronization is
required.

fa 11111010 start current sequence

fb 11111011 continue a stopped sequence where left
off

fc 11111100 stop a sequence


the following table lists the numbers corresponding to notes for use in note
on and note off commands.


octave|| note numbers
# ||
|| c | c# | d | d# | e | f | f# | g | g# | a | a# | b
-----------------------------------------------------------------------------
0 || 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11
1 || 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23
2 || 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35
3 || 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47
4 || 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59
5 || 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71
6 || 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83
7 || 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95
8 || 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107
9 || 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119
10 || 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 |


bibliography

"midi systems and control" francis rumsey 1990 focal press

"midi and sound book for the atari st" bernd enders and wolfgang klemme
1989 m&amp;t publishing, inc.

midi file specs and general midi specs were also obtained by sending e-mail
to listserv@auvm.american.edu with the phrase get midispec package
in the message.


------------------------------- dec.cpp ------------------------------------

/* file dec.cpp

by dustin caldwell (dustin@gse.utah.edu)

*/


#include <dos.h>
#include <stdio.h>
#include <stdlib.h>

void helpdoc();

main()
{
file *fp;

unsigned char ch, c;

if((fp=fopen(_argv[1], "rb"))==null) /* open file to read */
{
printf("cannot open file %s/n",_argv[1]);
helpdoc();
exit(-1);
}

c=0;
ch=fgetc(fp);

while(!feof(fp)) /* loop for whole file */
{
printf("%u/t", ch);
/* print every byte's decimal equiv. */
c++;
if(c>8) /* print 8 numbers to a line */
{
c=0;
printf("/n");
}

ch=fgetc(fp);
}

fclose(fp);
/* close up */
}

void helpdoc() /* print help message */
{
printf("/n binary file decoder/n/n");

printf("/n syntax: dec binary_file_name/n/n");

printf("by dustin caldwell (dustin@gse.utah.edu)/n/n");
printf("this is a filter program that reads a binary file/n");
printf("and prints the decimal equivalent of each byte/n");
printf("tab-separated. this is mostly useful when piped /n");
printf("into another file to be edited manually. eg:/n/n");
printf("c:/>dec sonata3.mid > son3.txt/n/n");
printf("this will create a file called son3.txt which can/n");
printf("be edited with any ascii editor. /n/n");
printf("(rec.exe may also be useful, as it reencodes the /n");
printf("ascii text file)./n/n");
printf("have fun!!/n");
}

---------------------------- rec.cpp ----------------------------------

/* file rec.cpp
by dustin caldwell (dustin@gse.utah.edu)
*/

#include <dos.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

void helpdoc();

main()
{
file *rfp, *wfp;

unsigned char ch, c;
char s[20];

if((rfp=fopen(_argv[1], "r"))==null) /* open the read file */
{
printf("cannot open file %s /n",_argv[1]);
helpdoc();
exit(-1);
}

if((wfp=fopen(_argv[2], "wb"))==null) /* open the write file */
{
printf("cannot open file %s /n",_argv[1]);
helpdoc();
exit(-1);
}

c=0;

ch=fgetc(rfp);

while(!feof(rfp)) /* loop for whole file */
{

if(isalnum(ch)) /* only 'see' valid ascii chars */
{
c=0;
while(isdigit(ch)) /* only use decimal digits (0-9) */
{
s[c]=ch;
/* build a string containing the number */
c++;
ch=fgetc(rfp);
}
s[c]=null;
/* must have null terminator */

fputc(atoi(s), wfp);/* write the binary equivalent to file */

}

ch=fgetc(rfp);
/* loop until next number starts */


}

fclose(rfp);
/* close up */
fclose(wfp);
}


void helpdoc() /* print help message */
{
printf("/n text file encoder/n/n");

printf("/n syntax: rec text_file_name binary_file_name/n/n");

printf("by dustin caldwell (dustin@gse.utah.edu)/n/n");
printf("this is a program that reads an ascii tab-/n");
printf("delimited file and builds a binary file where/n");
printf("each byte of the binary file is one of the decimal/n");
printf("digits in the text file./n");
printf(" eg:/n/n");
printf("c:/>rec son3.txt son3.mid/n/n");
printf("(this will create a file called son3.mid which is/n");
printf("a valid binary file)/n/n");
printf("(dec.exe may also be useful, as it decodes binary files)/n/n");
printf("have fun!!/n");
}


midi 1.0 specification


status data byte(s) description
d7----d0 d7----d0
-------------------------------------------------------------------------
channel voice messages
-------------------------------------------------------------------------
1000cccc 0nnnnnnn note off event.
0vvvvvvv this message is sent when a
note is released (ended).
(nnnnnnn) is the note number.
(vvvvvvv) is the velocity.

1001cccc 0nnnnnnn note on event.
0vvvvvvv this message is sent when a
note is depressed (start).
(nnnnnnn) is the note number.
(vvvvvvv) is the velocity.

1010cccc 0nnnnnnn polyphonic key pressure (after-touch).
0vvvvvvv this message is sent when the pressure
(velocity) of a previously
triggered note changes.
(nnnnnnn) is the note number.
(vvvvvvv) is the new velocity.

1011cccc 0ccccccc control change.
0vvvvvvv this message is sent when a controller
value changes. controllers include devices
such as pedals and levers.
certain controller numbers are reserved
for specific purposes. see channel mode messages.
(ccccccc) is the controller number.
(vvvvvvv) is the new value.

1100cccc 0ppppppp program change.
this message sent when the patch number changes.
(ppppppp) is the new program number.

1101nnnn 0ccccccc channel pressure (after-touch).
this message is sent when the channel pressure
changes. some velocity-sensing keyboardsdo
not
support polyphonic after-touch. use this
message to send the single greatest velocity
(of all te current depressed keys).
(ccccccc) is the channel number.

1110nnnn 0lllllll pitch wheel change.
0mmmmmmm this message is sent to indicate a change in the
pitch wheel. the pitch wheel is measured by a
fourteen bit value. center (no pitch change) is
2000h. sensitivity is a function of the
transmitter.
(llllll) are the least significant 7 bits.
(mmmmmm) are the most significant 7 bits.
-------------------------------------------------------------------------
channel mode messages (see also control change, above)
-------------------------------------------------------------------------
1011nnnn 0ccccccc channel mode messages.
0vvvvvvv this the same code as the control
change (above), but implements mode
control by using reserved controller
numbers. the numbers are:

local control.
when local control is off, all devices
on a given channel will respond only to
data received over midi. played data, etc.
will be ignored. local control on
restores the functions of the normal
controllers.
c = 122, v = 0: local control off
c = 122, v = 127: local control on

all notes off.
when an all notes off is received,
all oscillators will turn off.
c = 123, v = 0: all notes off

(see text for description of actual
mode commands.)
c = 124, v = 0: omni mode off
c = 125, v = 0: omni mode on
c = 126, v = m: mono mode on (poly off)
where m is the number of channels
(omni off) or 0 (omni on)
c = 127, v = 0: poly mode on (mono off)
(note: these four messages also cause
all notes off)
.pa
-------------------------------------------------------------------------
system common messages
-------------------------------------------------------------------------
11110000 0iiiiiii system exclusive.
0ddddddd this message makes up for all that midi
..do
esn't support. (iiiiiii) is a seven
.. bit manufacturer's i.d. code. if the
0ddddddd synthesizer recognizes the i.d. code as
11110111 its own, it will listen to the rest of
the message (ddddddd). otherwise, the
message will be ignored. system exclusive
is used to send bulk dumps such as patch
parameters and other non-spec data.
(note: real-time messages only may be
interleaved with a system exclusive.)

11110001 undefined.

11110010 0lllllll song position pointer.
0mmmmmmm this is an internal 14 bit register that
holds the number of midi beats (1 beat=
six midi clocks) since the start of
the song. l is the lsb, m the msb.

11110011 0sssssss song select.
the song select specifies which sequence
or song is to be played.

11110100 undefined.

11110101 undefined.

11110110 tune request.
upon receiving a tune request, all analog
sythesizers should tune their oscillators.

11110111 end of exclusive.
used to terminate a system exclusive
dump (see above).
.pa
-------------------------------------------------------------------------
system real-time messages
-------------------------------------------------------------------------
11111000 timing clock.
sent 24 times per quarter note when
synchronization is required (see text).

11111001 undefined.

11111010 start.
start the current sequence playing.
(this message will be followed with
timing clocks).

11111011 continue.
continue at the point the sequence was
stopped.

11111100 stop.
stop the current sequence.

11111101 undefined.

11111110 active sensing.
use of this message is optional. when
initially sent, the receiver will expect
to receive another active sensing message
each 300ms (max), or it will be assume
that the connection has been terminated.
at termination, the receiver will turn off
all voices and return to normal (non-
active sensing) operation.

11111111 reset.
reset all receivers in the system to
power-up status. this should be used
sparingly, preferably under manual
control. in particular, it should not
be sent on power-up.

-- greg, lee@uhccux.uhcc.hawaii.edu


general midi level spec



**** brief overview of proposed general midi level 1 spec ****

the heart of general midi (gm) is the _instrument patch map_, shown in
table 1 (see below). this is a list of 128 sounds, with corresponding
midi program numbers. most of these are imitative sounds, though the
list includes synth sounds, ethnic instruments and a handful of sound
effects.
the sounds fall roughtly into sixteen families of eight variations
each. grouping sounds makes it easy to re-orchestrate a piece using
similar sounds. the instrument map isn't the final word on musical
instruments of the world, but it's pretty complete
general midi also includes a _percusssion key map_, show in table 2
(see below). this mapping derives from the roland/sequential mapping
used on early drum machines. as with the instrument map, itdo
esn't
cover every percussive instrument in the world, but it's more than
adequate as a basic set.
to avoid concerns with channels, gm restricts percussion to midi
channel 10. theoretically, the lower nine channels are for the
instruments, but the gm spec states that a sound module must respond
to all sixteen midi channels, with dynamic voice allocation and a
minimum of 24 voices.
general midido
esn't mention sound quality of synthesis methods.
discussions are under way on standardizing sound parameters such as
playable range and envelope times. this will ensure that an arrangement
that relies on phrsing and balance can play back on a variety of
modules.
other requirements for a gm sound module include response to velocity,
mod wheel, aftertouch, sustain and expression pedal, main volume and
pan, and the all notes off and reset all controllers messages. the
module also must respond to both pitch bend and pitch bend sensitivity
(a midi registered parameter). the default pitch bend range is +-2
semitones.
middle c (c3) corresponds to midi key 60, and master tuning must be
adjustable. finally, the midi manufacturers association (mma) created a
new universal system exclusive message to turn general midi on and off
(for devices that might have "consumer" and "programmable" settings).
table 3 (see below) summarizes these requirements.
general midi has room for future expansion, including additional drum
and instrument assignments and more required controllers. also under
discussion is an "authorizingdo
cument" that would standardize things
such as channel assignments (e.g., lead on 1, bass on 2, etc.) and setup
information in a midi file.

copies of the level 1 specificationdo
cuments for general midi ($5 each
at last notice) are available from the internation midi association,
5316 west 57th street los angeles, ca 90056, (213) 649-6434. the first
issue of the journal of the mma (back issues, $15 each) contains an
article by passport designs and stanley junglieb about general midi.


roland's gs standard

when warner new media first proposed a general midi standard, most mma
members gave it little thought. as discussions proceeded, roland
listened and developed a sound module to meet the proposed
specification. at the same namm show where the mma ratified general midi
level 1, roland showed their sound brush and sound canvas, a standard
midi file player and gm-compatible sound module.
some companies feel that general midido
esn't go far enough, so roland
created a superset of general midi level 1, which they call gs standard.
it obeys all the protocols and sound maps of general midi and adds many
extra controllers and sounds. some of the controllers use unregistered
parameter numbers to give macro control over synth parameters such as
envelope attack and decay rates.
the new midi bank select message provides access to extra sounds
(including variations on the stock sounds and a re-creation of the mt-32
factory patches). the programs in each bank align with the original 128
in general midi's instrument patch map, with eight banks housing related
families. the gs standard includes a "fall back" system. if the sound
canvas receives a request for a bank/program number combination that
does not exist, it will reassign it to the master instrument in that
family. a set of roland system exclusive messages allows reconfiguration
and customization of the sound module.
this means that a roland gs standard sound module will correctly play
back any song designed for general midi. in addition, if the song's
creator wants to create some extra nuance, they can include the gs
standard extensions in their sequence. none of these extensions are so
radical as to make the song unplayable on a normal gm sound module.
after all, compatibility is what midi - and especially general midi - is
all about.
music authors interested in the gs standard should contact tom white
at rolandcorp usa, 7200do
minion circle, los angeles, ca 90040, (213)
685-5141.

**** table 1 - general midi instrument patch map ****
(groups sounds into sixteen families, w/8 instruments in each family)

prog# instrument prog# instrument

(1-8 piano) (9-16 chrom percussion)
1 acoustic grand 9 celesta
2 bright acoustic 10 glockenspiel
3 electric grand 11 music box
4 honky-tonk 12 vibraphone
5 electric piano 1 13 marimba
6 electric piano 2 14 xylophone
7 harpsichord 15 tubular bells
8 clav 16 dulcimer

(17-24 organ) (25-32 guitar)
17 drawbar organ 25 acoustic guitar(nylon)
18 percussive organ 26 acoustic guitar(steel)
19 rock organ 27 electric guitar(jazz)
20 church organ 28 electric guitar(clean)
21 reed organ 29 electric guitar(muted)
22 accoridan 30 overdriven guitar
23 harmonica 31 distortion guitar
24 tango accordian 32 guitar harmonics

(33-40 bass) (41-48 strings)
33 acoustic bass 41 violin
34 electric bass(finger) 42 viola
35 electric bass(pick) 43 cello
36 fretless bass 44 contrabass
37 slap bass 1 45 tremolo strings
38 slap bass 2 46 pizzicato strings
39 synth bass 1 47 orchestral strings
40 synth bass 2 48 timpani

(49-56 ensemble) (57-64 brass)
49 string ensemble 1 57 trumpet
50 string ensemble 2 58 trombone
51 synthstrings 1 59 tuba
52 synthstrings 2 60 muted trumpet
53 choir aahs 61 french horn
54 voice oohs 62 brass section
55 synth voice 63 synthbrass 1
56 orchestra hit 64 synthbrass 2

(65-72 reed) (73-80 pipe)
65 soprano sax 73 piccolo
66 alto sax 74 flute
67 tenor sax 75 recorder
68 baritone sax 76 pan flute
69 oboe 77 blown bottle
70 english horn 78 skakuhachi
71 bassoon 79 whistle
72 clarinet 80 ocarina

(81-88 synth lead) (89-96 synth pad)
81 lead 1 (square) 89 pad 1 (new age)
82 lead 2 (sawtooth) 90 pad 2 (warm)
83 lead 3 (calliope) 91 pad 3 (polysynth)
84 lead 4 (chiff) 92 pad 4 (choir)
85 lead 5 (charang) 93 pad 5 (bowed)
86 lead 6 (voice) 94 pad 6 (metallic)
87 lead 7 (fifths) 95 pad 7 (halo)
88 lead 8 (bass+lead) 96 pad 8 (sweep)

(97-104 synth effects) (105-112 ethnic)
97 fx 1 (rain) 105 sitar
98 fx 2 (soundtrack) 106 banjo
99 fx 3 (crystal) 107 shamisen
100 fx 4 (atmosphere) 108 koto
101 fx 5 (brightness) 109 kalimba
102 fx 6 (goblins) 110 bagpipe
103 fx 7 (echoes) 111 fiddle
104 fx 8 (sci-fi) 112 shanai

(113-120 percussive) (121-128 sound effects)
113 tinkle bell 121 guitar fret noise
114 agogo 122 breath noise
115 steel drums 123 seashore
116 woodblock 124 bird tweet
117 taiko drum 125 telephone ring
118 melodic tom 126 helicopter
119 synth drum 127 applause
120 reverse cymbal 128 gunshot


**** table 2 - general midi percussion key map ****
(assigns drum sounds to note numbers. midi channel 10 is for percussion)

midi drum sound midi drum sound
key key

35 acoustic bass drum 59 ride cymbal 2
36 bass drum 1 60 hi bongo
37 side stick 61 low bongo
38 acoustic snare 62 mute hi conga
39 hand clap 63 open hi conga
40 electric snare 64 low conga
41 low floor tom 65 high timbale
42 closed hi-hat 66 low timbale
43 high floor tom 67 high agogo
44 pedal hi-hat 68 low agogo
45 low tom 69 cabasa
46 open hi-hat 70 maracas
47 low-mid tom 71 short whistle
48 hi-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 chinese cymbal 76 hi 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


**** table 3 - general midi minimum sound module specs ****

voices:
a minimum of either 24 fully dynamically allocated voices
available simultaneously for both melodic and percussive sounds or 16
dynamically allocated voices for melody plus eight for percussion.

channels:
general midi mode supports all sixteen midi channels. each channel can
play a variable number of voices (polyphony). each channel can play a
different instrument (timbre). keybased percussion is always on
channel 10.

instruments:
a minimum of sixteen different timbres playing various instrument
sounds. a minimum of 128 preset for intruments (midi program numbers).

note on/note off:
octabe registration: middle c(c3) = midi key 60. all voices including
percussion respond to velocity.

controllers:
controller # description
1 modulation
7 main volume
10 pan
11 expression
64 sustain
121 reset all controllers
123 all notes off

registered description
parameter #
0 pitch bend sensitivity
1 fine tuning
2 coarse tuning

additional channel messages:
channel pressure (aftertouch)
pitch bend

power-up defaults:
pitch bend amount = 0
pitch bend sensitivity = +-2 semitones
volume = 90
all other controllers = reset

(after electronic musician, 8/91 issue)
--------------------------------------------------------------------------------

date: tue, 14 jan 92 23:01:16 est
from: jeff@millie.loc.gov (jeff mallory)
subject: general midi level spec


midi sample dump standard

index

1) introduction
2) spec: sample dump formats
3) spec: sample dump messages
4) dump procedure: master (dump source)
5) dump procedure: slave (dump destination)
6) sds overview
1) introduction

the midi sds was adopted in january 1986 by the midi
manufacturers association and the japanese midi standards committee.
the sds defines the standard method for transfer of sound sample data
between midi-equipped devices. sample dumps may be accomplished with
either an 'open loop' or 'closed loop' system. the open loop method
simply involves the straight dump of all sample data from its source
to the destination, with no timeouts, packet acknowledgements, or any
other form of handshaking, much as in the manner of a sysex bulk dump,
usually intiated at the source. the closed loop method allows the use
of handshaking messages between the dump source and destination, and
usually places the dump process under the control of the slave, to
allow it time to process the incoming data as necessary. as with any
standard, it can not be assumed that a device adheres to it unless the
accompanyingdo
cumentation specifically indicates it. even then
, it is
best to check its conformity with non-critical data.

2) spec: sample dump formats

dump header:

f0 7e cc 01 ss ss ee ff ff ff gg gg gg hh hh hh ii ii ii jj f7

where

cc = channel number
ss ss = sample number (lsb first)
ee = sample format (number of significant bits;
8->28)
ff ff ff = sample period (1/sample rate) in nanoseconds (lsb first)
gg gg gg = sample length, in words
hh hh hh = sustain loop start point (word number) (lsb first)
ii ii ii = sustain loop end point (word number) (lsb first)
jj = loop type (00:forwards only;
01:alternating)

data packet:

f0 7e cc 02 kk <120 bytes> mm f7

where

cc = channel number
kk = running packet count (00->7f)
mm = checksum (xor of 7e, cc, 02, kk <120 bytes>)

the total size of a data packet is 127 bytes. this is to avoid
overflow of the midi input buffer of a device that may want to receive
an entire packet before processing it.
a data packet consists of its own header, a packet number, 120
bytes of data, a checksum, and an eox. the packet number begin
s at 00
and increments with each new packet. it resets to 00 after it reaches
7f, and continues counting. the packet number is used by the receiver
to distinguish between a new data packet, or a resend of a previous
packet. the packet number is followed by 120 bytes of data, which form
60, 40, or 30 words (msb first for multiword samples), depending on
the length of a single data sample.
each data byte hold seven bits, with the msb in each byte set to
0, in order to conform to the requirements of midi data transmission.
information is left justified within the 7-bit bytes, and unused bits
are filled with 0.
example: assume a data point in the memory of a 16-bit sampler,
with the value 87e5. in binary, that would be

1000 0111 1110 0101

and would be encoded as the following midi data stream:

01000011 01111001 00100000

the checksum is the running xor of all the data after the sysex
byte, up to but not including the checksum itself.

3) spec: sample dump messages

dump request:

f0 7e cc 03 ss ss f7

where

cc = channel number
ss ss = sample number requested (lsb first)

upon receiving the request, the sampler checks the sample number
to see if it is within legal range. if it is not, the request is
ignored. if it is, the sample dump is started. one packet at a time is
sent, under control of the handshaking messages outlined below.

handshaking messages:

for all below:

cc = channel number
pp = packet number

packet numbers are included in the handshaking messages to
accomodate machines that have the intelligence to re-transmit specific
packets after an entire dump is finished, or if synchronization is
lost.

ack : f0 7e cc 7f pp f7

means last packet was recieved correctly (checksum ok, etc),
please send next one. packet number is packet being acknowledged as
correct.

nak : f0 7e cc 7e pp f7

means last packet not received correctly, please send again.
packet number is packet being rejected.

cancel : f0 7e cc 7d pp f7

means abort dump immediately. packet number is packet on which
abort occurs.

wait : f0 7e cc 7c pp f7

means pause dump indefinitely, until next message is sent. allows
the unit recieving the dump to perform other functions (disk access,
etc), before receiving the remainder of the dump. the next message it
sends (eg ack, abort) will determine if the dump continues or aborts.

4) dump procedure: master (dump source)

once a dump has been requested, either via midi or through the
front panel, the dump header is sent. after sending the header, the
master must time out for at least two seconds, to allow the receiver
to decide if it will accept this sample (has enough memory, etc).
if it receives a cancel, within this time, it should abort
immediately. if it receives an cak, it will start sending packets
immediately. if it receives a wait, it pauses until another message is
received, and then
processes that mesage normally. if nothing is
recieved within the timeout, an open loop is assumed, and the dump
starts with the first packet.
after sending each packet, the master should time out for at
least 20 milliseconds and watch its midi in. if an ack is received, it
sends the next packet immediately. if it receives an nak, and the
packet number matches the number of the last packet sent, it resend
that packet if the packet numbersdo
n't match, and the device is
incapable of sending packets out of order, the nak will be ignored.
if a wait is received, the master should watch its midi in port
indefinitely for another ack, nak, or cancel message, which it should
then
process normally.
if no messages are received within 20 milliseconds of the
transmission of a packet, the master may assume an open loop
configuration, and send the next packet.
this process continues until there are less than 121 data bytes
to send.
the final packet will still consist of 120n bytes, regardless
of how many significant bytes actually remain, and the unused bytes
will be filled with zeroes. the receiver should handshake after
receiving the last packet.

5) dump procedure: slave (dump destination)

when receiving a sample dump, a device should keep a running
checksum during reception. if its checksum matches the checksum in the
data packet, it will send an ack and wait for the next packet. if it
does not match, it will send an nak containing the number of the
packet that caused the error, and wait for the next packet. if, after
sending an nak, the packet number of the next packetdo
esn't match the
previous packet number (the one that was nak'd), and the unit is not
capable of accepting packets out of order, the error is ignored and
the dump continues as if the checksums had matched.
if a receiver runs out of memory before the dumpo is completed,
it should send a cancel to stop the dump.

6) sds overview

sample dump data format: dump header:

sysex
id: universal non-real time
channel number
sub id: header
sample number (2 bytes, lsb first)
sample format
sample period (3 bytes, lsb first)
sample length (3 bytes, lsb first)
sustain loop start point (3 bytes, lsb first)
sustain loop end point (3 bytes, lsb first)
loop type
eox

sample dump data format: data packet:

sysex
id: universal non-real time
channel number
sub id: data packet
packet number
sample data (120 bytes)
checksum
eox

sample dump messages: dump request:

sysex
id: universal non-real time
channel number
sub id: dump request
sample number (2 bytes, lsb first)
eox

sample dump messages: handshaking flags:

sysex
id: universal non-real time
channel number
sub id: ack or nak or cancel or wait
packet number
eox





 
O

OpuBF

Unregistered / Unconfirmed
GUEST, unregistred user!
http://home.etang.com/bobe_zsc/

http://www.why.com.cn/computer/hardware/Program/Sound.html
 
Y

YaoChangLi

Unregistered / Unconfirmed
GUEST, unregistred user!
多人接受答案了。
 
T

ttkk

Unregistered / Unconfirmed
GUEST, unregistred user!
其实我有MIDI有中文文档!!可惜水评太低看不明白!!能说一下要如何读取MIDI文件吗?
请发邮件到ttkk@21cn.com
 

Similar threads

顶部 底部