gtrtab2midi - converts ascii-tab guitar tablature to MIDI
gtrtab2midi infile.tab | aplaymidi -
gtrtab2midi infile.tab | fluadity -
gtrtab2midi -p 24 infile.tab | aplaymidi - # patch 24
gtrtab2midi -t 140 infile.tab | aplaymidi - # 140mS/pulse
gtrtab2midi -T 8 infile.tab | aplaymidi - # 8 pulses/sec
gtrtab2midi infile.tab > outfile.mid
midiedit outfile.mid
gtrtab2midi converts ascii-tab guitar tablature to MIDI, which can then be played using fluadity or aplaymidi, or edited using midiedit
gtrtab2midi
uses a more compact and rhythmic version of ascii-tab guitar tablature,
in which each character represents a particular elapsed time
(by default one sixth of a second). This means the ascii text is
(at least) twice as compact, and the rhythm is clearly specified.
The following example is the first four bars of
The London Rag,
and an MP3 of
gtrtab2midi london_rag.tab | fluadity -
can be heard here.
e|3-0---------|--0-----0---|--3--02-02-3|---3--3--3-3|
B|---3-0------|-----3-----0|--2---3--3-0|---0-0--12-3|
G|------3-02-0|1----1------|------2--2-0|------------|
D|---0-----0--|---0-----0--|---2--0-----|---3--2--1--|
A|------------|------------|0--------0--|------------|
E|3-----3-----|0-----0-----|------------|3-----------|
Therefore, to represent the high frets with one character, gtrtab2midi
supports the following extension to standard guitar tablature notation:
within the system, using hexadecimal notation for the high frets :
A
play the tenth 10th fret
B
play the eleventh 11th fret
C
play the twelfth 12th fret (the octave)
D
play the thirteenth 13th fret
E
play the fourteenth 14th fret
F
play the fifteenth 15th fret
gtrtab2midi supports only the following on-string symbols,
which have the same rhythmic value as a dash - :
x
ends the note on that string
*
the adjoining number on the left (C,7,5 or 4) was a harmonic
b
bend up one semitone
^
bend up two semitones
p
pre-bend one semitone
P
pre-bend two semitones
r
release the one-semitone bend
R
release the two-semitone bend
Bending is only offered over one or two semitones.
An example of bending: on the B-string,
---3-b3---
plays a d which bends smoothly up the eb,
followed immediately by a new d.
Or ---3-b--rx---
plays a d which bends smoothly up the eb
and then releases back down again fo the d.
An example of pre-bending: on the B-string,
----5--p8-r-x--
plays an e then a pre-bent g# releasing back down to a g
Conventional ascii-tab guitar tablature is described in en.wikipedia.org/wiki/ASCII_tab
Since version 1.6, gtrtab2midi offers a syntax for setting a voice-line. The voice-line starts with VF| or VM| for female or male voices respectively. It looks something like this example:
VM|---A-----------|---------F#-----|G--------------|F#-----E--D-----|
d|---------------|---------- -----|---------------|- --------------|
A|---------------|---------- -----|---------------|- --------------|
G|-----77-7--77-7|-----77-7- -77-7|-----77-7--77-7|- ----77-7--77-7|
D|7--7--7--7--7--|7--7--7--7 --7--|7--7--7--7--7--|7 --7--7--7--7--|
A|0--------0-----|0--------0 -----|0--------0-----|0 --------0-----|
D|0--------0-----|0--------0 -----|0--------0-----|0 --------0-----|
Voices don't have frets, so the pitches are notated differently,
using a notation which borrows from
muscript
but uses the tablature-time-pulse for rhythm.
Near the middle of each clef there is a "c". This note is written c and the notes above it are written c# d eb en f f# g g# a bb b c~ c~# d~ e~b and so on up to b~. Likewise, the notes below c are B Bb A Ab G F# F E Eb D C# C B_ B_b A_ and so on down to C_. Thus on each voice-line you can write a range of nearly four octaves.
Each such note is one time-pulse long even if it uses two characters like F# so you may find it neater to pad the guitar-strings with a blank underneath the # or b in order to preserve the vertical alignment.
The default midi-patch for the voice is 82, but you can change this with the -P option.
This option sets the MIDI Patch, to 24 = Acoustic Guitar(nylon) in this example. The default is 25 = Acoustic Guitar(steel). See www.pjb.com.au/muscript/gm.html for a list of the General-MIDI patch numbers.
This option sets the MIDI Voice-patch, to 85 = Lead 6 (voice) in this example. The default is 82 = Lead 3 (calliope). See www.pjb.com.au/muscript/gm.html for a list of the General-MIDI patch numbers.
This options sets the Tempo, in milliseconds per pulse, where a
pulse is the time taken by a -
in the ascii-tab input.
The pulse is therefore the shortest time-interval you can express in ascii-tab,
a sixteenth-note (semiquaver) for example.
The default is 167, meaning a sixth of a second.
This option is an alternative to the -t option;
it sets the Tempo in pulses per second, where a pulse
is the time taken by a -
in the ascii-tab input.
The pulse is therefore the shortest time-interval you can express in ascii-tab.
The default is 6, meaning 167 milliseconds.
Print the Version
This script is freely available at
www.pjb.com.au/midi/free/gtrtab2midi
Move it to somewhere in your $PATH
,
and if necessary change the first line
to reflect where lua is installed.
It needs the MIDI.lua module, which is available from
www.luarocks.org
so you should be able to install it by:
luarocks install midi
20200602 1.7 add back-compatible argument *a for io.read()
20180826 1.6 add a VM or VF voice-line
20180819 1.5 -T option for pulses/sec
20180809 1.4 bending with -3-b3- and -p3-r1- also ^, P and R
20180807 1.3 C* 7* 5* 4* 9* are the natural harmonics
20180806 1.2 x ends the note on that string
20180804 1.1 introduce -t and -p options
20180801 1.0 initial release
Peter J Billam, www.pjb.com.au/comp/contact.html
pjb.com.au/mus/arr/tab/folk_gtr_solos.tab
en.wikipedia.org/wiki/ASCII_tab
www.guitartricks.com/helptab.php
how-to-play-electric-guitar.net/tab-symbols.html
en.wikipedia.org/wiki/Tablature#Guitar_tablature
pjb.com.au/muscript/gm.html
pjb.com.au/midi/gtrtab.html
pjb.com.au/midi/midiedit.html
luarocks.org/modules/peterbillam
pjb.com.au/muscript/index.html#pitches
pjb.com.au/