Logo Elephant's Homepage zh en
Album Diary Articles Gifts  
MIDI Composer

  • txt mid Johann Pachelbel - Canon (thank icy for inputting the score)
  • txt mid Johann Sebastian Bach - Minuet
  • txt mid Johann Sebastian Bach - Invention 14th
  • txt mid Johann Sebastian Bach - Preludio
  • txt mid John Rutter - For the Beauty of the Earth

Sorry for my English. Please visit the Chinese version if you understand Chinese.

MIDI Composer accepts a series of words as input. Words are separated by spaces (including space, tab and new-line) or bar-line "|". Each word conforms a certain format and represents one or more notes, or a MIDI controller message.

Note words

A note word is in the form of [note][duration]. In [note], use 1234567 0 or CDEFGAB P to represent the 7 notes on the keyboard and the rest. Prefix - or + to the number or letter to lower or raise one octave, prefix ! or # to lower or raise half tone. Immediately following [note] is [duration], . / \ and - represent adding a half, cutting a half, multiplying 1/3 (useful in writing triplets) and adding a quarter note to the duration, respectively. If no [duration] exists, the duration will be a quarter note. Summarization:

note prefixduration
-lower one octave .add a half
+raise one octave /cut a half
!lower half tone \multiply by 1/3
#raise half tone -add a quarter note

Some examples and more complicated writings: (Notice the spaces!)

+#4/. 0//3/16 note high fa sharp, 1/16 note rest
5 1/ 2/ 3/ 4/ 5 1 1minuet (Bach)
5 1234/ 511 same as above, notes with equal durations may be connected
(135) (-613) major and minor triad, simultaneous notes should be bracketed
(135)(246)(357)(46+1)appliction of the two rules above
1~3~5~ (135+1)~ stands for tie, do not stop until the same note occurs (and no more ties)
[52]the 52nd note, useful with percussions on channel 9

None note words

Following is the descriptions of some none note words (N is a none negative, letters inside brackets may be left out):

initial value
$N0 select channel, N=0~15, channel 9 for percussions
I(nstrument)=N0select instrument, N=0~127
S(ignature)=N/N2/4 set time signature, like 2/4 3/4 4/4 3/8 6/8 etc.
T(empo)=N750000 set tempo, each quarter note last N microseconds
V(olume)=N127 set channel volume, N=0~127
P(osition)=N64 set channel postion, N=0~127, 0 for left most, 127 for right most
// single-line comment, characters until line end would be ignored
/* multi-lines comment begin, characters between /* and */ would be ignored
*/ multi-lines comment end

Note shift words

When the notes on the staff go too high or too low or modulate, note shift words may be useful in simplifying the writing. For example, ++1 ++2 ++3 ++4 may be written as ++ 1 2 3 4, where ++ means all notes thereafter will raise two octaves. Explanation on note shift words (always remember that 1~7 is equal with C~B):

initial value
-lower one octave, repetition permitted
+raise one octave, repetition permitted
1(C)=N60 set 1(C) to specified pitch N, N=10~127, in unit of half tone
1(C)=noteset 1(C) to pitch that note stand for, pitch that note stand for is relative to the last 1(C)=N
1..7(C..B)accidental1234567% all corresponding notes thereafter will lower or raise half tone or revert

It's worth to mention that, when a note prefix only modifies the immediate following note, a note shift word will affect all the notes that come after it. If a note is affected by a long range sharp or flat, note prefix % may be use to revert the note to its nature tone. Here is an example, the following lines all play with an identical result:

C=60 1234567+1      567+1+2+3+#4+5      +1+2+3+4+5+6+7++1
C=60 1234567+1 C=G  1234567+1      C=+C 1234567+1
C=60 1234567+1 C=67 1234567+1      C=F  1234567+1
C=60 1234567+1      567+1+2+3+#4+5 +    1234567+1
C=60 1234567+1 4#   567+1+2+3+4+5       +1+2+3+%4+5+6+7++1

Strength control words

Strength of notes may be controled with words relating to < or >. < stands for gradually increasing and > stands for gradually decreasing. Detial description (N is a none negative):

initial value
< gradually increase the strength at a default speed (see below), repetition permitted
> gradually decrease the strength at a default speed, repetition permitted
=stop increasing/decreasing
>N<10 set the default increasing/decreasing speed, increase or decrease N every quarter note
<N>64 set the strength to N, N=1~127, and stop increasing/decreasing
<>report the strength here
<Nincrease the strength at a speed of N
>Ndecrease the strength at a speed of N

Synchronization control words

When the staff becomes long, in order to keep synchronization between channels against input mistake, also in order to avoid writing too long rest when a channel suspend playing, synchronization control words are introduced:

assert_equal declare that all existing channels's play time are equal, return with error otherwise
make_equal make all channels's play time equal, fill shorter channels with rests

Instrument list

general instruments (I=N)percussions ($9 [N])
0Acoustic Grand Piano64Soprano Sax
1Bright Acoustic Piano65Alto Sax
2Electric Grand Piano66Tenor Sax
3Honky-tonk Piano67Baritone Sax
4Electric Piano 1 (Rhodes Piano)68Oboe
5Electric Piano 2 (Chorused Piano)69English Horn
10Music Box74Recorder
11Vibraphone75Pan Flute
12Marimba76Blown Bottle
14Tubular Bells78Whistle
15Dulcimer (Santur)79Ocarina
16Drawbar Organ (Hammond)80Lead 1 (square wave)
17Percussive Organ81Lead 2 (sawtooth wave)
18Rock Organ82Lead 3 (calliope)
19Church Organ83Lead 4 (chiffer)
20Reed Organ84Lead 5 (charang)
21Accordion (French)85Lead 6 (voice solo)
22Harmonica86Lead 7 (fifths)
23Tango Accordion (Band neon)87Lead 8 (bass + lead)
24Acoustic Guitar (nylon)88Pad 1 (new age Fantasia)
25Acoustic Guitar (steel)89Pad 2 (warm)
26Electric Guitar (jazz)90Pad 3 (polysynth)
27Electric Guitar (clean)91Pad 4 (choir space voice)
28Electric Guitar (muted)92Pad 5 (bowed glass)
29Overdriven Guitar93Pad 6 (metallic pro)
30Distortion Guitar94Pad 7 (halo)
31Guitar harmonics95Pad 8 (sweep)
32Acoustic Bass96FX 1 (rain)
33Electric Bass (fingered)97FX 2 (soundtrack)
34Electric Bass (picked)98FX 3 (crystal)
35Fretless Bass99FX 4 (atmosphere)
36Slap Bass 1100FX 5 (brightness)
37Slap Bass 2101FX 6 (goblins)
38Synth Bass 1102FX 7 (echoes, drops)
39Synth Bass 2103FX 8 (sci-fi, star theme)
44Tremolo Strings108Kalimba
45Pizzicato Strings109Bag pipe
46Orchestral Harp110Fiddle
48String Ensemble 1 (strings)112Tinkle Bell
49String Ensemble 2 (slow strings)113Agogo
50SynthStrings 1114Steel Drums
51SynthStrings 2115Woodblock
52Choir Aahs116Taiko Drum
53Voice Oohs117Melodic Tom
54Synth Voice118Synth Drum
55Orchestra Hit119Reverse Cymbal
56Trumpet120Guitar Fret Noise
57Trombone121Breath Noise
59Muted Trumpet123Bird Tweet
60French Horn124Telephone Ring
61Brass Section125Helicopter
62SynthBrass 1126Applause
63SynthBrass 2127Gunshot
35Acoustic Bass Drum
36Bass Drum 1
37Side Stick
38Acoustic Snare
39Hand Clap
40Electric Snare
41Low Floor Tom
42Closed Hi Hat
43High Floor Tom
44Pedal Hi-Hat
45Low Tom
46Open Hi-Hat
47Low-Mid Tom
48Hi Mid Tom
49Crash Cymbal 1
50High Tom
51Ride Cymbal 1
52Chinese Cymbal
53Ride Bell
55Splash Cymbal
57Crash Cymbal 2
59Ride Cymbal 2
60Hi Bongo
61Low Bongo
62Mute Hi Conga
63Open Hi Conga
64Low Conga
65High Timbale
66Low Timbale
67High Agogo
68Low Agogo
71Short Whistle
72Long Whistle
73Short Guiro
74Long Guiro
76Hi Wood Block
77Low Wood Block
78Mute Cuica
79Open Cuica
80Mute Triangle
81Open Triangle

Example staff

$0       +3+#2// | +3+#2+37+2+1// | 6/ 0//
$1 C=-C  0/      | 0.             | -636//

$0   136// | 7/ 03#57//  | +1/ 03+3+#2// |
$1   0/.   | -33#5// 0/. | -636// 0/.    |