NAME
MIDI::Tab - Generate MIDI from ASCII tablature
SYNOPSIS
use MIDI::Tab;
use MIDI::Simple;
new_score;
my $drums = <<'EOF';
CYM: 8-------------------------------
BD: 8-4---8-2-8-----8-4---8-2-8-----
SD: ----8-------8-------8-------8---
HH: 66--6-6-66--6-6-66--6-6-66--6-6-
OHH: --6-------6-------6-------6-----
EOF
my $bass = <<'EOF';
G3: --------------------------------
D3: --------------------------------
A2: 5--53-4-5--53-1-----------------
E2: ----------------3--31-2-3--23-4-
EOF
for(1 .. 4){
synch(
sub {
from_drum_tab($_[0], $drums, 'sn');
},
sub {
from_guitar_tab($_[0], $bass, 'sn');
},
);
}
write_score('demo.mid');
DESCRIPTION
MIDI::Tab
allows you to create MIDI files from ASCII tablature. It is designed to work alongside Sean M. Burke's MIDI::Simple
.
Currently, there are three types of tablature supported: drum, guitar and piano tab.
METHODS
Each of these routines generates a set of MIDI::Simple notes on the object passed as the first parameter. The parameters are:
MIDI:Simple object
Tab Notes (as ASCII text)
Noop Arguments (for changing channels etc)
Parameters to the from_*_tab()
routines, that are specified after the tablature string, are passed as MIDI::Simple::noop
calls at the start of the tab rendering. For example, the length of each unit of time can be specified by passing a MIDI::Simple
duration value (eg 'sn').
from_guitar_tab()
from_guitar_tab($object, $tab_text, @noops)
Notes are specified by an ASCII representation of a guitar with each horizontal line of ASCII characters representing a guitar string (as if the guitar were laid face-up in front of you).
Time runs from left to right. You can 'tune' the guitar by specifying different root notes for the strings. These should be specified as a MIDI::Simple
alphanumeric absolute note value (eg 'A2'). The numbers of the tablature represent the fret at which the note is played.
from_drum_tab()
from_drum_tab($object, $tab_text, @noops)
Each horizontal line represents a different drum part and time runs from left to right. Minus or plus characters represent rest intervals. As many or as few drums as required can be specified, each drum having a two or three letter code, such as BD
for the General MIDI "Bass Drum 1" or SD
for the "Acoustic Snare." These are all listed in %MIDI::Tab::drum_notes
, which can be viewed or altered by your code.
The numbers on the tablature represent the volume of the drum hit, from 1 to 9, where 9 is the loudest.
If desired, the MIDI channel that is used for drums (default 9) can be changed by altering $MIDI::Tab::drum_channel
.
from_piano_tab()
from_piano_tab($object, $tab_text, @noops)
Each horizonal line represents a different note on the piano and time runs from left to right.
SEE ALSO
* The code in the eg/
and t/
directories.