MIDI::Praxis::Variation - Variation techniques used in music composition
version 0.0607
use MIDI::Praxis::Variation ':all'; # Or import individually by function name: # use MIDI::Praxis::Variation qw(augmentation diminution etc); my @notes = qw(C5 E5 G5); my @dura = qw(qn qn); my @x = augmentation(@dura); @x = diminution(@dura); my $y = dur('qn'); @x = inversion('B4', @notes); $y = note2num('C5'); @x = ntup(2, @notes); @x = notes2nums(@notes); $y = raugmentation(1.5, @dura); $y = rdiminution(1.5, @dura); @x = retrograde(@notes); @x = retrograde_inversion('B4', @notes); @x = transposition(-12, @notes); # Transpose an octave down $y = tie_durations(@dura);
Melodic variation techniques, as implemented here, expect MIDI::Simple style note names or durations as input. They return MIDI note numbers or duration values in ticks (where one quarter note = 96 ticks).
$x = note_name_to_number($note_name); $x = note2num($note_name);
Map a single note name to an equivalent MIDI note number (or -1 if not known).
@x = original(@array); @x = notes2nums(@array);
Map a list of note names to MIDI note numbers.
@x = retrograde(@array);
Form the retrograde of an array of note names as MIDI note numbers.
@x = transposition($distance, @array);
Form the transposition of an array of notes or MIDI note numbers.
Arguments:
$distance - An integer giving distance and direction. @array - An array of note names OR MIDI note numbers.
For example, 8 indicates 8 semitones up while -7 asks for 7 semitones down.
@x = inversion($axis, @array);
Form the inversion of an array of notes.
$axis - A note to use as the axis of this inversion. @array - An array of note names.
Expects to see a MIDI note name followed by an array of such names. These give the axis of inversion and the notes to be inverted.
@x = retrograde_inversion($axis, @array);
Form the retrograde inversion of an array of notes.
Inverts about the supplied axis.
$x = dur($dur_or_len);
Compute duration of a note in MIDI ticks.
$dur_or_len - A string consisting of a MIDI tick numeric duration spec (e.g. d48, or d60) or length spec (e.g. qn or dhn)
$x = tye(@dur_or_len); $x = tie_durations(@dur_or_len);
Compute the sum of the durations of notes, as with a tie in music notation. (The odd spelling is used to avoid conflict with the perl reserved word tie.)
@dur_or_len - A list of strings consisting of MIDI tick numeric duration specs (e.g. d48, or d60) or length specs (e.g. qn or dhn)
$x = raugmentation($ratio, @dur_or_len);
Augment duration of notes, multiplying them by $ratio.
$ratio - Multiplier @dur_or_len - A list of MIDI tick numeric duration specs (e.g. d48, or d60) or length specs (e.g. qn or dhn)
$x = rdiminution($ratio, @dur_or_len);
Diminish duration of notes, dividing them by $ratio.
$ratio - Divisor @dur_or_len - A list of MIDI tick numeric duration specs (e.g. d48, or d60) or length specs (e.g. qn or dhn)
@x = augmentation(@dur_or_len);
Augment duration of notes multiplying them by 2, (i.e. double) and return each in an array reference.
@x = diminution(@dur_or_len);
Diminish durations of notes dividing them by 2, (i.e. halve) and return each in an array reference.
@x = ntup($nelem, @subject);
Catalog and return tuples of length $nelem in @subject.
$nelem - Number of elements in each tuple @subject - Subject array to be scanned for tuples
Scan begins with the 0th element of @subject looking for a tuple of length $nelem. Scan advances by one until it has found all tuples of length $nelem. For example: given the array @ar = qw(1 2 3 4) and $nelem = 2, then ntup(2, @ar) would return qw(1 2 2 3 3 4).
@ar = qw(1 2 3 4)
$nelem = 2
ntup(2, @ar)
qw(1 2 2 3 3 4)
Note that if $nelem equals -1, 0, or a value greater than the size of @subject, this function will return ();
-1
0
()
The eg/* and t/01-functions.t files in this distribution
Exporter
MIDI::Simple
Gene Boggs <gene@cpan.org>
Craig Bourne <cbourne@cpan.org>
This software is copyright (c) 2004 by Craig Bourne.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install MIDI::Praxis::Variation, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MIDI::Praxis::Variation
CPAN shell
perl -MCPAN -e shell install MIDI::Praxis::Variation
For more information on module installation, please visit the detailed CPAN module installation guide.