NAME
Music::MelodicDevice::Transposition - Apply chromatic and diatonic transposition to notes
VERSION
version 0.0100
SYNOPSIS
use Music::MelodicDevice::Transposition;
my @notes = qw(C4 E4 D4 G4 C5);
# Chromatic
my $md = Music::MelodicDevice::Transposition->new;
my $transposed = $md->transpose(2, \@notes); # [D4, F#4, E4, A4, D5]
$transposed = $md->transpose(4, \@notes); # [E4, G#4, F#4, B4, E5]
# Diatonic
$md = Music::MelodicDevice::Transposition->new(scale_name => 'major');
$transposed = $md->transpose(2, \@notes); # [E4, G4, F4, B4, E5]
$transposed = $md->transpose(4, \@notes); # [G4, B4, A4, D5, G5]
DESCRIPTION
Music::MelodicDevice::Transposition
applies transposition, both chromatic or diatonic, to a series of ISO formatted notes.
While there are a modules on CPAN that do chromatic transposition, none appear to apply diatonic transposition to an arbitrary series of notes. Hence this module.
ATTRIBUTES
scale_note
Default: C
scale_name
Default: chromatic
For the chromatic scale, enharmonic notes are listed as sharps. For a scale with flats, a diatonic scale_name must be used with a flat scale_note.
Please see "SCALES" in Music::Scales for a list of valid scale names.
verbose
Default: 0
METHODS
new
$md = Music::MelodicDevice::Transposition->new(
scale_note => $scale_note,
scale_name => $scale_name,
verbose => $verbose,
);
Create a new Music::MelodicDevice::Transposition
object.
transpose
$transposed = $md->transpose($offset, $notes);
Return the transposed series of notes.
SEE ALSO
The t/01-methods.t test file
AUTHOR
Gene Boggs <gene@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2020 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.