GnuMidiCompiler
Table of Contents
1.) What is it?
2.) How to install
3.) How to compile
4.) Tutorial
4.1) Lection 1:Simple Tones
4.2) Lection 2:Length variation
4.3) Lection 3:Sequences
4.4) Lection 4: Simultanous tones
4.5) Lection 5:Pretty tones
4.6) Lection 6:transposition
4.7) Lection 7:Karako midis
4.8) Lection 8: Tempo and measure
4.9) Lection 4.9: Taking parts of sequences
4.10) Lection 4.10: Intro and ending
4.11) Section 11: Drums
4.12) Section 12: Labels
4.13) Section 13: Including
4.14) Lection 12: Miscelanious
5.) Reference
5.1) Available tones
5.2 available Note length variations
5.3) Available drums
6.) Todo
1.) What is it?
Gnu Midi Compiler is a tool which enables you to produce midi files from text files. You can type the names of the tones in the text files and they will be audible in the midi file. The concept of defining 'sequences' is very important.
A sequence is a combination is a set of tones which you can refer to inside the file by the name sequence's name. See section 4.3.
2.) How to install
Type make in the untarred source directory (probably where you are right now).
If you are lucky, you will not have to modify the Makefile.
The compiler will generate a 'gmc' executable file. At the same time,
all the demo midi files will be generated. Have fun listening to them!
3.) How to compile your gmc text file to midi.
Compilation is not difficult, since you can not mispell options
(there aren't any). The syntax is:
gmc <textfile>
A .midi file will be produced with the same base filename.
4.) Tutorial
The best method for learning to use this tool is to play around with the example files included in the distribution. This way you do not have to create files from scratch and risk wasting time tracking down simple errors which otherwise may stop you from learning.
4.1) Lection 1:Simple Tones
For this tutorial, example file contents will be enclosed between '---' delimiters.
For a simple sequence of tones, simply write the names of each note in a text file, one per line.
C
D
E
F
G
A
B
c
This is just a simple sequence of tones which follows the example
file in lections/lection1.txt. Notice it starts with 'C' and ends
with 'c'.
To compile this test:
gmc lection1.txt
4.2) Lection 2:Length variation
Having all tones the same length is quite boring.
Why not vary their length? Adding a number after a tone makes this
note that many times longer.
Attitionally, adding a / halves the length of a tone, adding a \ cuts
the length of the note to 1/3.
Of course you can combine these attributes like
c5//
this is tone c with length 1.25.
C
D/
E/
F3/
G\
A\
B\
c/
G/
E/
C
4.3) Lection 3:Sequences
If you were to write songs like this, you would have to write 100's of kilobytes worth of raw text just to create a reasonable midi file. How about we define a sequence once and use it four times, like:
define mysequence1
C
G
c
d
end
define mysequence2
C
G
e
G
end
place mysequence1 num=4
place mysequence1 num=4
You need not use parameter num. If you leave it out, only one copy of the sequence is substituted. (default=1) BTW: This is the beginning of the song 'Ballade pur adeline'.
4.4) Lection 4: Simultanous tones
In Real songs, more than one note is played at a time. How can we do this?
c
e
g
^c
at bar 0
G
c
e
g
at bar 0
E
G
c
e
This makes a midi file with four nice chords. In this version bar always refers to 4 normal length notes. You need not only write 'at bar 0' but 'at bar 5'.
4.5) Lection 5:Pretty tones
Now it is time to make the tones themselves a little bit nicer. What about changing their duration, their voice and their volume like:
c volume=64 voice=flute reverb=127 duration=0.5
All these values must be in range from 0 to 127. By the way, all these options are also allowed with the define and place statements.
4.6) Lection 6:transposition
You can simply transpose a sequence using the options offset and transpose. Transpose moves the pitch of all tones in a sequence harmonically with a base of the tone C. Transposing 7 tones means you are transposing an octave. Offset moves the pitch of all tones of a sequence n halftones.
This is a litle sample of some tone-sequences
define tones
C2
D
E
F
G
A
B
c2
B
A
G
F
E
D
end
place tones
place tones transpose=0
place tones transpose=1
place tones transpose=2
place tones transpose=3
place tones offset=0
place tones offset=1
place tones offset=2
place tones offset=3
4.7) Lection 7:Karake midis
You can easily make karaoke midi files. Just add a property to each note denoting the current text to be displayed. Use _ instead of space. Denote text to appear with a note by starting the text with a '#' sign. To separate the text of different strophes with the '|' symbol. When you use the 'place' command, select with strophe of text you want with the strophe=X parameter. Strophe=0 means no text. For example:Jingle bells
define refrain
e text=Jin|This e text=gle_|could e2 text=Bells,|be e text=Jing|any e text=gle|second e2 text=Bells,|strophe e text=Jin|if g text=gle_|it c3/ text=all_|existed d/ text=the_| e4 text=way|
end
place refrain strophe=1
place refrain strophe=2
4.8) Lection 8: Tempo and measure
You can vary the tempo inside the song by using 'tempo X', where X is the
number of beats per minute you wish the song to be played at. You can
also set the measure anywhere in the same fashion with 'measure X Y'.
Measure is not used in the internal calculations yet, it is just written
to the midi file.
You can change the tempo continuously through a sequence by using
the tempo1=X and tempo2=Y flags to the place command.
define song
c
d
e
f
g
f
e
d
end
measure 4 4
tempo 70
place song
tempo 120
place song
place song tempo1=40 tempo2=80
4.9) Lection 4.9: Taking parts of sequences
If you have defined a sequence, but you don't want to place the whole sequence, you can use the cutbeg and/or the cutend statements. The cutbeg and cutend parameters define the portion of the sequence to use. They are measured in quarter notes.
define song
c
d
e
f
g
f
e
d
end
place song
place song cutend=4
place song cutbeg=4
4.10) Lection 4.10: Intro and ending
You can change the dynamics of your intro and ending.
define song
c
d
e
f
g
f
e
d
c4
end
place song intro=1
place song
place song ending=1
4.11) Section 11: Drums
You can also use drums instead of tones. You can use this to compile nice rhythms. A nice rhytm sounds like:
define rhythm
kickdrum/
closedhihat//
closedhihat//
snaredrum/
closedhihat//
closedhihat//
end
place rhythm num=10
4.12 Labels)
You can set labels just like
e
label1:
a
c
e
label1:
d
f
g
The first time a label name is encountered, its postition is stored. Every next time, the same label encounters, time is set to the stored position
4.13) Including
Within a gmc song you can include oder gmc-files by just typing
include song.gmc
example
-------lection13a---
define beat1
snaredrum
p
snaredrum
p
end
define beat2
kickdrum
p
snaredrum
p
end
-------lection13b---
include lection13a.gmc
place beat1 num=20
4.14) Lection 12: Miscelanious
You can easily set the origin of a sequence by just saying origin
somewhere within a sequence. Normally the origin is set at the beginning.
If you finished a song, you probably want to include info about the
author, the song, etc in your midi file. Just say 'info hello' to put
the word hello into the midi file.
Note: You need to have different times for different texts if the order
is important. Otherwise gmc will mix them up due to its internal
quicksort algorithm.
define auftakt
G
A
B
origin
end
define song
c
e
g
e
c4
end
info This_isatext_info
at bar 1
info This_is_another_info
at bar 0
place auftakt
place song
Comment sign is #
#This is a comment
5.) Reference
5.1) Available tones
C C Cb D D Db E Eb E F F Fb G G Gb F F Fb G G Gb A A Ab B B Bb c c cb d d db e eb e f f fb g g gb f f fb g g gb a a ab b b bb ^c ^c ^cb ^d ^d ^db ^e ^eb ^e ^f ^f ^fb ^g ^g ^gb ^f ^f ^fb ^g ^g ^gb ^a ^a ^ab ^b ^b# ^bb
DOb DO DO REb RE RE MIb MI MI FAb FA FA SOLb SOL SOL LAb LA LA SIb SI SI dob do do reb re re mib mi mi fab fa fa solb sol sol lab la la sib si si p
p means pause
5.2 available Note length variations
[Note]2 2 * [Note]3 3 * [Note]4 4 * [Note]5 5 * [Note]6 6 * [Note]7 7 * [Note]8 8 * [Note]9 9 * [Note]/ 0.5 * [Note]\ 1/3 *
5.3) Available drums
kickdrum sidestick snaredrum handclap snaredrum2 lowtom2 closedhihat lowtom pedalhihat midtom2 openhihat midtom hightom2 crashcymbal hightom ridecymbal chinesecymbal ridebell tambourine splashcymbal cowbell crashcymbal vibraslap ridecymbal2 highbongo lowbongo mutehighconga mutelowconga lowconga hightimbale lowtimbale highangogo lowangogo cabasa matacas shorthiwhistle loblowwhistle shortguiro longguiro claves highwoodblock lowwoodblock mutecuica opencuica mutetriangle opentriangle shaker jinglebell belltree castanets mutesurdo opensurdo slap scratch1 scratch2 sticks squareclick metronomeclick metronomebell kickdrum2 highq
6.) Some words of the author
Due to my big interest in midi files, I have written this tool.
I did not find any good tool to generate midi files, so I did this tool.
Advantages against graphical midi sequencers are in my opinion
- You need not exactly select a tone with your mouse,
you can just enter its name
- You can define a sequence once and use it many times
- You can alter the sequence when placing
- You need not bother with channel allocation
- You don't need a graphical environment
- If the drum rhymtmus isn't satisifying, just change it once,
not all during the song
- You can directly assign a text to a tone
- Disadvantages
- No graphical enviroment
- There is no midi player included
Additions to the advantages/disadvantages list are welcome
If you created a nice song with gmc, you may send it to me. I am really interested, in what gmc is really capable of doing. My email is guenther.sohler@newlogic.at
Have fun with the GnuMidiCompiler
6.) Todo
*Improve Code style
*Document option gain
*Document, how to do comments
Thanx to
*Niki W. Waibel<niki.waibel@newlogic.com> for testing it
*Leon Kirsch <vlkirsch@pt.lu> for adding the italien/french tune names
*Chrisman <incubus@netcom.com> for supporting readable documentation
*Iestyn Lewis <irl@camsoft.com> for just telling me, that he is happy with it
*MIDI because it is so good
