Music::Chord::Progression - Create network transition chord progressions
version 0.0401
use Music::Chord::Progression; my $prog = Music::Chord::Progression->new; my $chords = $prog->generate; my $chord = $prog->substitution('m'); # m7 or mM7
Music::Chord::Progression creates network transition chord progressions.
Music::Chord::Progression
Also this module can perform limited jazz chord substitutions, if requested in the constructor.
The maximum number of chords to generate.
Default: 8
8
The network transitions between chords of the progression.
Default:
{ 1 => [qw( 1 2 3 4 5 6 )], 2 => [qw( 3 4 5 )], 3 => [qw( 1 2 4 6 )], 4 => [qw( 1 3 5 6 )], 5 => [qw( 1 4 6 )], 6 => [qw( 1 2 4 5 )] }
Alternative example:
{ 1 => [qw( 1 2 3 4 5 6 )], 2 => [qw( 3 5 )], 3 => [qw( 2 4 6 )], 4 => [qw( 1 2 3 5 )], 5 => [qw( 1 )], 6 => [qw( 2 4 )] }
The keys must start with 1 and be contiguous to the end.
1
Ending on 12 represents all the notes of the chromatic scale, for instance. Ending on 7 can represent the diatonic notes, given the scale_name.
12
7
If you do not wish a scale note to be chosen, include it among the keys, but do not refer to it and do not give it any neighbors.
For example, the chord for the 5th degree of the scale will not be chosen here:
{ 1 => [qw( 1 2 3 4 6 7)], 2 => [qw( 3 )], 3 => [qw( 2 4 6 )], 4 => [qw( 1 2 3 )], 5 => [], 6 => [qw( 2 4 )], 7 => [qw( 1 4 )] }
The chord names of each scale position.
The number of items in this list must be equal and correspond to the number of keys in the net.
Default: [ '', 'm', 'm', '', '', 'm' ]
[ '', 'm', 'm', '', '', 'm' ]
Here '' refers to the major chord and 'm' means minor.
''
'm'
[ 'M7', 'm7', 'm7', 'M7', '7', 'm7' ]
The different chord names are listed in the source of Music::Chord::Note.
The name of the scale.
Default: major
major
Please see "SCALES" in Music::Scales for the allowed scale names.
The (uppercase) name of the scale starting note.
Default: C
C
The scale notes. This is a computed attribute.
Default: [C D E F G A B]
[C D E F G A B]
The octave number of the scale.
Default: 4
4
Whether to start the progression with the tonic chord or not.
If this is given as 1 the tonic chord starts the progression. If given as 0 a neighbor of the tonic is chosen. If given as -1 a random net key is chosen.
0
-1
Default: 1
Whether to end the progression with the tonic chord or not.
If this is given as 1 the tonic chord ends the progression. If given as 0 a neighbor of the last chord is chosen. If given as -1 a random net key is chosen.
Whether to perform jazz chord substitution.
Default: 0
Rules:
The subroutine to execute to determine if a chord substitution should happen.
Default: sub { int rand 4 == 0 } (25% of the time)
sub { int rand 4 == 0 }
Whether to use flats instead of sharps in the generated chords or not.
The network transition Graph object. This is a computed attribute.
Default: Graph::Directed
Graph::Directed
Show the generate and substitute progress.
$prog = Music::Chord::Progression->new; # Use the defaults $prog = Music::Chord::Progression->new( # Override the defaults max => 4, net => { 1 => [...], ... 6 => [...] }, chord_map => ['m','','m','m','',''], scale_name => 'minor', scale_note => 'A', octave => 5, tonic => 0, resolve => -1, substitute => 1, verbose => 1, );
Create a new Music::Chord::Progression object.
$chords = $prog->generate;
Generate a fresh chord progression.
$substitute = $prog->substitution($chord_name);
Perform a jazz substitution on the given the chord_name.
The t/01-methods.t test and eg/* example files
Carp
Data::Dumper::Compact
Graph
Moo
Music::Chord::Note
Music::Scales
Gene Boggs <gene@cpan.org>
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.
To install Music::Chord::Progression, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Music::Chord::Progression
CPAN shell
perl -MCPAN -e shell install Music::Chord::Progression
For more information on module installation, please visit the detailed CPAN module installation guide.