MIDI::Tab - generate MIDI music from ascii tablature
Document each function properly Explain about first parameter to functions Maybe simple test suite
Try to make it so that from_guitar_tab etc can be called as a normal method or function call (instead of passing object as first parameter)
use MIDI::Tab; use MIDI::Simple; new_score; # From MIDI::Simple 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( # From MIDI::Simple sub { from_drum_tab($_[0], $drums, 'sn'); }, sub { from_guitar_tab($_[0], $bass, 'sn'); }, ) } write_score('demo.mid'); # From MIDI::Simple
MIDI::Tab allows you to create MIDI files from ascii tablature. It is designed to work alongside Sean M Burke's MIDI::Simple. There are currently three types of tablature supported:
Drum Tab
Each horizontal line represents a different drum, 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. Currently supported are: BD - Bass Drum, SD - Snare Drum, HH - Hi-Hat, OHH - Open Hi-Hat, CYM - Crash Cymbal. More can be added by writing to the hash %MIDI::Tab::drum_notes (see source for example). The numbers on the tablature represents the volume of the drum hit (from 1 to 9, where 9 is the loudest). Any parameters to from_drum_tab specified after the tablature string are passed to a call to 'noop' at the start of the tab rendering, so for example the length of each unit of time can be specified by passing a standard MIDI::Simple duration value (eg 'sn'). The channel that is used to play the drum notes can be changed by altering $MIDI::Tab::drum_channel (defaults to 'c9').
Guitar Tab
Notes here are specified on an ascii representation of a guitar with each horizontal line of ascii characters representing one string on the guitar (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 in the tablature represent the fret at which the note is played. Any parameters to from_guitar_tab specified after the tablature string are passed to a call to 'noop' at the start of the tab rendering, so for example the length of each unit of time can be specified by passing a standard MIDI::Simple duration value (eg 'sn') and the instrument can be selected (eg 'c3').
Piano Tab
Here, each horizonal line represents a different note on the piano and time runs from left to right.
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)
See synopsis for examples.
Examples can be found in the 'examples' directory.
Robert J. Symes rob@robsymes.com
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
MIDI::Simple, perl(1).
To install MIDI::Tab, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MIDI::Tab
CPAN shell
perl -MCPAN -e shell install MIDI::Tab
For more information on module installation, please visit the detailed CPAN module installation guide.