Txt2Trak - converts a .txt file into midi for Ditty,Tinker
When I first tried out a sequencer called Bars&Pipes for my
ooooooooole Amiga 500, I was kind of upset that I had to "click" in sheet
music if I wanted to get the sequencer to play it.
Click the "add" tool, Click the quarter note duration,
find out where middle C was on the display and Click it,
and keep Click Click Clickin away with ALL those dang notes...
I wished for a "text file sheet music format" so I could use
my speedy typing skills to "Type Type Type" in a song.
I came up with a text format that describes sheet music and converts to midi.
I'll start with a song example,
then simple snippet examples,
then move on to the detailed syntax diagram.
________________________________________________________________________________
song Example:
You'll need more than one .txt file to define a song,
so it's best to make a directory for the song and
put each of the files in it. For example...
{MidiPath}\Compose\Txt\Nushooz_CantWait\
CantWait.song
CantWait.txt
drum.txt
left.txt
right.txt
vocal.txt
bass_a.txt
bass_b.txt
bass_c.txt
Take a look at the .song file (which is just a text file)...
Track:
. Drum\Drum .DrumTrack
. Bass\Syn1 .Left
. SynLead\Sawtooth .Right
. SynLead\Voice .Vocal
Control:
Tmpo
Vol
Marker:
1 intro
9 verse
25 chorus
31 bridge1
33 bridge2
43 coda
Section:
intro
verse
chorus
bridge1
intro
verse
chorus
bridge2
coda
coda
We have 4 tracks that use the default midiout device and certain sounds.
The last thing on the line is a track name/description
The song uses 2 controls:
tempo and volume.
The intro starts at bar 1, verse at bar 9, etc
Then we say how to order and repeat the section of the song.
________________________________________________________________________________
We also have CantWait.txt containing...
$cd@fga@
!Tmpo=120
#Drum
NextTrack
#Left
NextTrack
#Right
NextTrack
#Vocal
That's the top level .txt file to create our tracks.
Mostly it just "includes" other .txt files for each individual track and
then has a "NextTrack" to start the, umm, Next Track.
Lines starting with - are comment lines.
The $cd@fga@ line sets the scale so that e and b notes always get flatted.
(unless natural'd)
!Tmpo=120 sets the tempo control at 120
Drum.txt is the first file to load in and "do".
Txt2Trak looks for files in the same directory as the top .txt file
AND in the {MidiPath}\Compose\Clip\* directories
(You can put any common tracks in the Clip directory like drum patterns, etc)
________________________________________________________________________________
Drum.txt in turn has the drum track referencing the drum clips in Clip dir...
------- intro
-- 8 bars of drums in ABABABAC pattern using rock 5,7,f9
-- (8 bars of non chorus)
#DrumPat\Rock\05
#DrumPat\Rock\07
#DrumPat\Rock\05
#DrumPat\Rock\07
#DrumPat\Rock\05
#DrumPat\Rock\07
#DrumPat\Rock\05
#DrumFill\Rock\09
------- verse
#DrumPat\Rock\05
#DrumPat\Rock\07
#DrumPat\Rock\05
#DrumPat\Rock\07
#DrumPat\Rock\05
#DrumPat\Rock\07
#DrumPat\Rock\05
#DrumFill\Rock\09
#DrumPat\Rock\05
...etc...
________________________________________________________________________________
Clip\DrumPat\Rock\05.txt (for example) in turn has...
--- Rock 5
s kick hhcl
s
s kick hhcl
s
s snar!hhcl!
s
s kick hhcl
s
s hhcl
s
s kick hhcl
s
s snar!hhcl!
s
s kick hhcl
s
________________________________________________________________________________
After the full drum track is built, there's a
NextTrack command to, well, start the next track, derrr...
We do the left hand piano track.
It uses 3 one bar bass patterns (bass_a, bass_b and bass_c.txt)
Then right hand piano track and finally the vocal track.
For example, right.txt has...
!vol=80
---------------------------------------- intro 1
e 5b, h eg
e b
e 6d
e c
e 5gb, q e
s 6c
s 5g
e
e b
----------
e 5b, q.s df
e b
e 6d
s c
sq 5dfgb
e
e b
---------- 3
...etc...
!vol=80
means set volume control to 80 (of 127)
and then we start the notes (remembering the scale we set)
e 5b, h eg
means play an eighth note on octave 5 note b
(which will be flatted per our scale)
and at the same time start a half note with e and g (same octave)
our leftmost duration was an eighth so
the next line down's note starts RIGHT after that.
The articulation for the note defaults to leggerio (3/4 the full duration).
You can set the default articulation (effecting ALL following notes, too) to
staccato < (1/4 dur)
portato = (1/2 dur)
leggerio > (3/4 dur - the default if ommitted) or
legato - (full dur)
I tend to put -- lines at the bar boudaries
in general, lines start with a Duration then OctaveNote.
A trailing comma means that another note group starts at the same time
with usually a different (longer) duration
Look through this example song and see if you can make out the syntax.
________________________________________________________________________________
Snippet examples:
assume that the scale is...
$cd@fga@ will flatten all E and B notes: @=flat, #=sharp
q 5ceg makes a minor chord on middle C (e is flattened by scale)
played for a quarter note duration
with leggerio articulation
(note is released 3/4 way thru the duration)
q ce%g makes a major chord
% suffix on a note makes it natural - overrides the scale
h.e.- 5b% makes a middle octave B (no flatting from the scale)
with a duration of a dotted half plus dotted eighth
with a legato articulation (-)
(note isn't released until full duration is over)
h- 5e
h d make a slurred middle E flat (cuzu the scale) to middle D
The E@ is played at time 0
with a half note duration
with legato articulation
The D is played after a half note and will sound RIGHT
after the E@
with a half note duration
with leggerio articulation
Note that the "start time" of each notegroup is determined by
the duration of the FIRST (leftmost) notegroup in each line
If you have notes that have durations that cross measures you may want to go:
h 5fa6c
h, h. 5ce%5g
-- next note starts while prev measure's c chord has only played for half dur
h 6c
fingering syntax...:)
add a [fingering] right after note
q 5c[1]e[3]g[5] will put little fingering numbers by the note
q 5c[23] press with finger2 and hold with finger3
(thumb is finger 1 of either hand .. pinky is 5)
________________________________________________________________________________
Full Syntax:
I tried to make this notation as flexible as sheet music is
so the format is a bit complex.
(although limitations ARE there. Esp note velocity, etc)
-
lines starting with the '-' character are comments. They're ignored.
#
lines starting with the '#' character mean to include the named .txt file.
ex: #drum 80 will include the drum.txt file 80 times
other lines are note event lines in this format:
[this means optional] {this means 0 or many} (this means 1 or many)
notegroup[,notegroup]
notegroup = duration {frequency}
duration = [rolled](value[modifier])[articulation]
rolled = ~ roll the notes (a 64th note gap in start times)
value = W hole note H alf
Q uarter E ighth
S ixteenth T hirtysecond
6 tyfourth 1 hundred twenty eighth
2 hundred fifty sixth...:)
G grace note - end note RIGHT before current time and start it
a legato 32nd note before that
modifier = . dotted
3 triplet
...else unaltered duration
articulation = < stacatto 1/4
= portato 1/2
> leggerio 3/4 will make all E and B notes into Eb and Bb (umm, flat) and
the default articulation leggerio
!
lines starting with the '!' character are control change events
for example...
!Vol=100
!PBnd=64
!Tmpo=120 (in BPM)
Here are all the controls:
Prog, Prss, PBnd,
Vol, Expr, Pan, Bal,
Mod, Brth, Pedl,
Hold, Hld2, Soft, Sust, Lega,
Sld1, Sld2, Sld3, Sld4,
Btn1, Btn2, Btn3, Btn4,
Tmpo
Duration breakout (for those into gory detail - timing 'ticks' per duration)
normal dotted=. triplet=3
w 768 1152 512
h 384 576 256
q 192 288 128
e 96 144 64
s 48 72 32
t 24 36 16
6 12 18 8
1 6 9 4
2 3 4? :/ 1
|