MIDI::Trans is a Perl module that serves as a quick development foundation for text to midi conversion algorithms utilizing MIDI::Simple for output. Using MIDI::Trans, you create callbacks for generating note, volume, duration and tempo values. As your corpus is read, these callbacks are utilized to generate your midi score by MIDI::Trans. MIDI::Trans is modelled after the text conversion aspects of TransMid (http://www.digitalkoma.com/church/projects/transmid/), but designed to be more useful to a wider range of tasks, with less overhead.
If you're in a big hurry, and haven't any need for great control over the process, simply read the 'Plug and Play Usage' and 'CallBacks' sections below to get a jump, and your converter implemented in a just a few minutes, with just a few statements.
A corpus can be defined as either a string, or text file. MIDI::Trans will then split that corpus into elements based on an element delimiter, provided via argument, and determine some attributes of the corpus based on other data, which can be supplied by the developer. The corpus is then processed, element by element through the use of CallBacks you specify. The normal flow of development looks like this:
Define Parameters For Conversion
Define Functions To Generate Note, Duration, Volume, Tempo
from parameters and element values.
Specify and process corpus
Create score
Write Output
... this section not yet complete...
SYNOPSIS
use MIDI::Trans;
my $TranObj = MIDI::Trans->new( {
'Delimiter' => '\s+',
'Note' => \¬e,
'Volume' => sub { return(127); },
'Duration' => \&somesub,
'Tempo' => sub { ... }
} );
if($TransObj->trans( { 'File' => 'text.txt', 'Outfile' => 'out.mid' })) {
print("success\n");
} else {
my $error = $TransObj->error();
die("ERR: $error\n");
}
sub note {
# do something
# return a value between 0 and 127
# or string 'rest' (sans quotes) for
# a rest event
}
sub duration {
# return some number of quarter notes
}
Product's homepage
Requirements:
· Perl