Music::Duration - Add 32nd, 64th, fractional and tuple durations to MIDI-Perl
version 0.0503
# Compare: # perl -MMIDI::Simple -MData::Dumper -e'$Data::Dumper::Sortkeys=1; print Dumper \%MIDI::Simple::Length' # perl -MMusic::Duration -MData::Dumper -e'$Data::Dumper::Sortkeys=1; print Dumper \%MIDI::Simple::Length' # In a program: use MIDI::Simple; use Music::Duration; Music::Duration::fractional('z', 5); # Create and set up a new_score, then for example: n('zsn', 'n38') for 1 .. 5; Music::Duration::tuple( 'qn', 'z', 5 ); n('zqn', 'n38') for 1 .. 5;
This module adds thirty-second and sixty-fourth note divisions to MIDI::Simple. These are 32nd: yn, dyn, ddyn, tyn and 64th: xn, dxn, ddxn, txn.
Also, this module allows the addition of non-standard note divisions with the fractional() and tuple() functions, detailed below.
Music::Duration::fractional( 'z', 5 ) # Then: $score->n( 'zqn', ... );
Add a fractional division to the MIDI::Simple Length hash. This allows the use of a time signature that is not 4/4 or 3/4.
Length
For a given name of 'z', this function adds the following durations:
zwn zhn zqn zen zsn zyn zxn
For the example of 5 divisions, this means that a whole note is 5 beats long. The duration for each division is "half as long as the last." So a half note is 2.5 beats long, and a quarter note is, you guessed it - 1.25. See the distribution test for the full breakdown.
Music::Duration::tuple( 'wn', 'z', 5 ); # Then: $score->n( 'zwn', ... );
Add a fractional division for a given duration of the MIDI::Simple Length hash.
Musically, this creates a "cluster" of notes in place of the given duration.
So instead of a whole note of four beats, we instead play 5 beats. A triplet is a 3-tuple.
Add dot, double-dot and triplet to the fractional durations.
The "Parameters for n/r/noop" section in MIDI::Simple
The code in the t/ directory
t/
Gene Boggs <gene@cpan.org>
This software is copyright (c) 2018 by Gene Boggs.
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 Music::Duration, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Music::Duration
CPAN shell
perl -MCPAN -e shell install Music::Duration
For more information on module installation, please visit the detailed CPAN module installation guide.