NAME

Music::Duration - Add 32nd, 64th, 128th and tuplet durations to MIDI-Perl

VERSION

version 0.0701

SYNOPSIS

# Compare lengths:
# perl -MMIDI::Simple -MData::Dumper -e '%x = %MIDI::Simple::Length; print Dumper [ map { "$_ => $x{$_}" } sort { $x{$a} <=> $x{$b} } keys %x ]'
# perl -MMusic::Duration -MData::Dumper -e '%x = %MIDI::Simple::Length; print Dumper [ map { "$_ => $x{$_}" } sort { $x{$a} <=> $x{$b} } keys %x ]'

# In a program:
use Music::Duration;

Music::Duration::tuplet( 'ten', 'z', 5 ); # 5 divisions in place of an eighth note triplet

my $black_page = MIDI::Simple->new_score();
# ...
$black_page->n( 'zten', 'n38' ) for 1 .. 5;

DESCRIPTION

This module adds 32nd, 64th, and 128th note divisions to MIDI::Simple %Length. It also adds fractional note divisions with the tuplet() function.

32nd durations added:

yn:   thirty-second note
dyn:  dotted thirty-second note
ddyn: double dotted thirty-second note
tyn:  thirty-second note triplet

64th durations added:

xn:   sixty-fourth note
dxn:  dotted sixty-fourth note
ddxn: double dotted sixty-fourth note
txn:  sixty-fourth note triplet

128th durations added:

on:   128th note
don:  dotted 128th note
ddon: double dotted 128th note
ton:  128th note triplet

FUNCTION

tuplet()

Music::Duration::tuplet( 'qn', 'z', 5 );
# $score->n( 'zqn', ... );

Music::Duration::tuplet( 'wn', 'z', 7 );
# $score->n( 'zwn', ... );

Add a fractional division to the MIDI::Simple Length hash for a given name and duration.

Musically, this creates a series of notes in place of the given duration.

A triplet is a 3-tuplet.

So in the first example, instead of a quarter note, we instead play 5 beats - a 5-tuple. In the second, instead of a whole note (of four beats), we instead play 7 beats.

tuple()

Synonym for the tuplet function.

SEE ALSO

The %Length hash in MIDI::Simple

The code in the eg/ and t/ directories

https://www.scribd.com/doc/26974069/Frank-Zappa-The-Black-Page-1-Melody-Score

https://en.wikipedia.org/wiki/Tuplet

AUTHOR

Gene Boggs <gene@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019 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.