| 1 | package Music::ToRoman; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 18 | our $AUTHORITY = 'cpan:GENE'; | |||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # ABSTRACT: Convert notes and chords to Roman numeral notation | ||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 18 | our $VERSION = '0.2002'; | |||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 18 | ▶ | use strictures 2; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 18 | ▶ | use List::SomeUtils qw(any first_index); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 18 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 18 | ▶ | use Music::Note (); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 18 | ▶ | use Music::Scales qw(get_scale_notes); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 18 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | has scale_note => ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 17 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 150 | ▶ | isa => sub { die 'Invalid note' unless _valid_note( $_[0] ) }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 3 | ▶ | default => sub { 'C' }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 18 | ); | |||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | has scale_name => ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 151 | ▶ | isa => sub { die 'Invalid scale' unless _valid_scale( $_[0] ) }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 20 | ▶ | default => sub { 'major' }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 18 | ); | |||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | has major_tonic => ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 152 | ▶ | isa => sub { die 'Invalid note' unless _valid_note( $_[0] ) }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 145 | ▶ | default => sub { 'C' }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 18 | ); | |||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||
| 37 | has chords => ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 153 | ▶ | isa => sub { die 'Invalid boolean' unless $_[0] == 0 || $_[0] == 1 }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
Branch: 1 branch
Condition100%3/3
$_[0] == 0 or $_[0] == 1
MC/DC100%2/2
$_[0] == 0 or $_[0] == 1
$_[0] == 0
$_[0] == 1
Truth table100%3/3
A or B
A= $_[0] == 0B= $_[0] == 1
| |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 22 | ▶ | default => sub { 1 }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 18 | ); | |||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||
| 44 | has verbose => ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 149 | ▶ | default => sub { 0 }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 18 | ); | |||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 1947 | ▶ | sub parse { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=39 SCAR=36.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 1947 | my ( $self, $chord ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 1947 | ▶ | die 'No chord to parse' | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 54 | unless $chord; | ||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 1946 | my $note_re = qr/[A-G][#b]?[#b]?/; | |||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # Get the roman representation of the scale | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 1946 | my @scale = $self->get_scale_mode; | |||||||||||||||||||||||||||||||||||||||||||||
| 60 | 1946 | ▶ | print "SCALE: @scale\n" if $self->verbose; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 1946 | my @notes; | |||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||
| 64 | # If the note has a double sharp and is not in major, manually rotate the scale notes, since Music::Scales does not. | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 1946 | ▶ | if ( $self->scale_note =~ /##/ && $self->scale_name ne 'major' && $self->scale_name ne 'ionian' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$self->scale_note =~ /##/ and $self->scale_name ne "major" and $self->scale_name ne "ionian"
$self->scale_note =~ /##/ and $self->scale_name ne "major"
MC/DC33%1/3
$self->scale_note =~ /##/ and $self->scale_name ne "major" and $self->scale_name ne "ionian"
$self->scale_note =~ /##/
$self->scale_name ne "major"
$self->scale_name ne "ionian"
Truth table50%2/4
A and B and C
A= $self->scale_note =~ /##/B= $self->scale_name ne "major"C= $self->scale_name ne "ionian"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 42 | my %modes = ( | |||||||||||||||||||||||||||||||||||||||||||||
| 67 | dorian => 2, | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | phrygian => 3, | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | lydian => 4, | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | mixolydian => 5, | ||||||||||||||||||||||||||||||||||||||||||||||
| 71 | aeolian => 6, | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | minor => 6, | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | locrian => 7, | ||||||||||||||||||||||||||||||||||||||||||||||
| 74 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 42 | @notes = get_scale_notes( $self->major_tonic, 'major' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||
| 78 | # Rotate the major scale to the correct mode | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 42 | push @notes, shift @notes for 1 .. $modes{ $self->scale_name } - 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 81 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 1904 | @notes = get_scale_notes( $self->scale_note, $self->scale_name ); | |||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 1946 | ▶ | print "NOTES: @notes\n" if $self->verbose; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # XXX Not working? | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | # my %ss_enharmonics = ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 88 | # 'C##' => 'D', | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | # 'D##' => 'E', | ||||||||||||||||||||||||||||||||||||||||||||||
| 90 | # 'F##' => 'G', | ||||||||||||||||||||||||||||||||||||||||||||||
| 91 | # 'G##' => 'A', | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | # 'A##' => 'B', | ||||||||||||||||||||||||||||||||||||||||||||||
| 93 | # ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 94 | # for ( @notes ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 95 | # $_ = $ss_enharmonics{$_} | ||||||||||||||||||||||||||||||||||||||||||||||
| 96 | # if $ss_enharmonics{$_}; | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # } | ||||||||||||||||||||||||||||||||||||||||||||||
| 98 | #use Data::Dumper;warn(__PACKAGE__,' ',__LINE__," MARK: ",Dumper\@notes); | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # Convert a diminished chord | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 1946 | $chord =~ s/dim/o/; | |||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||
| 103 | # Get just the note part of the chord name | ||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 1946 | ( my $note = $chord ) =~ s/^($note_re).*$/$1/; | |||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 1946 | my %bb_enharmonics = ( | |||||||||||||||||||||||||||||||||||||||||||||
| 107 | Cbb => 'Bb', | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | Dbb => 'C', | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | Ebb => 'D', | ||||||||||||||||||||||||||||||||||||||||||||||
| 110 | Fbb => 'Eb', | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | Gbb => 'F', | ||||||||||||||||||||||||||||||||||||||||||||||
| 112 | Abb => 'G', | ||||||||||||||||||||||||||||||||||||||||||||||
| 113 | Bbb => 'A', | ||||||||||||||||||||||||||||||||||||||||||||||
| 114 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 1946 | ▶ | $note = $bb_enharmonics{$note} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 117 | if $note =~ /bb$/; | ||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||
| 119 | # Get the roman representation based on the scale position | ||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 1946 | ▶ | my $position = first_index { $_ eq $note } @notes; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 1946 | ▶ | if ( $position < 0 && ( $note eq 'Cb' || $note eq 'Fb' ) ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%6/6
$position < 0 and $note eq "Cb" || $note eq "Fb"
$note eq "Cb" or $note eq "Fb"
MC/DC100%3/3
$position < 0 and $note eq "Cb" || $note eq "Fb"
$position < 0
$note eq "Cb"
$note eq "Fb"
Truth table100%4/4
A and B or C
A= $position < 0B= $note eq "Cb"C= $note eq "Fb"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 56 | ▶ | $note = 'B' | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 124 | if $note eq 'Cb'; | ||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 56 | ▶ | $note = 'E' | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 126 | if $note eq 'Fb'; | ||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 56 | ▶ | $position = first_index { $_ eq $note } @notes; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 129 | elsif ( $note eq 'E#' ) { # XXX Why does this work? | ||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 62 | $note = 'F'; | |||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 1946 | my $accidental = ''; | |||||||||||||||||||||||||||||||||||||||||||||
| 134 | 1946 | ▶ | if ( $position < 0 && $note =~ /[#b]+$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$position < 0 and $note =~ /[#b]+$/
MC/DC100%2/2
$position < 0 and $note =~ /[#b]+$/
$position < 0
$note =~ /[#b]+$/
Truth table100%3/3
A and B
A= $position < 0B= $note =~ /[#b]+$/
| |||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 208 | my $n = Music::Note->new( $note, 'isobase' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 136 | 208 | my $name = $n->format('isobase'); | |||||||||||||||||||||||||||||||||||||||||||||
| 137 | 208 | ( $accidental = $name ) =~ s/^[A-G]([#b]+)$/$1/; | |||||||||||||||||||||||||||||||||||||||||||||
| 138 | 208 | ▶ | $n->en_eq( $accidental =~ /^#/ ? 'b' : '#' ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 208 | $note = $n->format('isobase'); | |||||||||||||||||||||||||||||||||||||||||||||
| 140 | 208 | ▶ | $position = first_index { $_ eq $note } @notes; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 208 | $accidental = ''; | |||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # If the note is not in the scale find the new position and accidental | ||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 1946 | ▶ | if ( $position < 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 352 | ( $position, $accidental ) = _pos_acc( $note, $position, \@notes ); | |||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 1946 | my $roman = $scale[$position]; | |||||||||||||||||||||||||||||||||||||||||||||
| 150 | 1946 | ▶ | print "ROMAN 1: $roman\n" if $self->verbose; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||
| 152 | # Get everything but the note part | ||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 1946 | ( my $decorator = $chord ) =~ s/^(?:$note_re)(.*)$/$1/; | |||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # Are we minor or diminished? | ||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 1946 | ▶ | my $minor = $decorator =~ /[-moø]/ ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 1946 | ▶ | print "CHORD: $chord, NOTE: $note, NEW ACCI: $accidental, DECO: $decorator, MINOR: $minor, POSN: $position\n" if $self->verbose; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # Convert the case of the roman representation based on minor or major | ||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 1946 | ▶ | if ( $self->chords ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 719 | ▶ | $roman = $minor && $decorator !~ /maj/i ? lc($roman) : uc($roman); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$minor and not $decorator =~ /maj/i
MC/DC100%2/2
$minor and not $decorator =~ /maj/i
$minor
not $decorator =~ /maj/i
Truth table100%3/3
A and not(B)
A= $minorB= not $decorator =~ /maj/i
| |||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||
| 164 | # Add any accidental found in a non-scale note | ||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 1946 | ▶ | $roman = $accidental . $roman if $accidental; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 1946 | ▶ | print "ROMAN 2: $roman\n" if $self->verbose; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||
| 168 | # Handle these unfortunate edge cases: | ||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 1946 | $roman = _up_to_flat( $roman, \@scale ); | |||||||||||||||||||||||||||||||||||||||||||||
| 170 | 1946 | ▶ | print "ROMAN 3: $roman\n" if $self->verbose; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||
| 172 | # Handle the decorator variations | ||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 1946 | ▶ | if ( $decorator =~ /maj/i || $decorator =~ /min/i ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
$decorator =~ /maj/i or $decorator =~ /min/i
MC/DC100%2/2
$decorator =~ /maj/i or $decorator =~ /min/i
$decorator =~ /maj/i
$decorator =~ /min/i
Truth table100%3/3
A or B
A= $decorator =~ /maj/iB= $decorator =~ /min/i
| |||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 55 | $decorator = lc $decorator; | |||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 176 | elsif ( $decorator =~ /△/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | $decorator =~ s/△/maj/; | |||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 179 | elsif ( $decorator =~ /ø/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 1 | $decorator =~ s/ø/7b5/; | |||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 182 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 183 | # Drop the minor and major part of the chord name | ||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 1889 | $decorator =~ s/[-Mm]//i; | |||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 1946 | ▶ | print "DECO: $decorator\n" if $self->verbose; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||
| 188 | # A remaining note name is a bass decorator | ||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 1946 | ▶ | if ( $decorator =~ /($note_re)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 207 | my $name = $1; | |||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 207 | ▶ | $position = first_index { $_ eq $name } @notes; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 207 | ▶ | print "BASS NOTE: $name, POSN: $position\n" if $self->verbose; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 207 | ▶ | if ( $position >= 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 119 | $decorator =~ s/$note_re/$scale[$position]/; | |||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 198 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 88 | ( $position, $accidental ) = _pos_acc( $name, $position, \@notes ); | |||||||||||||||||||||||||||||||||||||||||||||
| 200 | 88 | ▶ | print "NEW POSN: $position, ACCI: $accidental\n" if $self->verbose; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 88 | my $bass = $accidental . $scale[$position]; | |||||||||||||||||||||||||||||||||||||||||||||
| 203 | 88 | $decorator =~ s/$note_re/$bass/; | |||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||
| 205 | # Handle these unfortunate edge cases | ||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 88 | $decorator = _up_to_flat( $decorator, \@scale ); | |||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 207 | ▶ | print "NEW DECO: $decorator\n" if $self->verbose; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||
| 211 | # Append the remaining decorator to the roman representation | ||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 1946 | $roman .= $decorator; | |||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 1946 | $roman =~ s/bI\b/vii/g; | |||||||||||||||||||||||||||||||||||||||||||||
| 215 | 1946 | $roman =~ s/bIV\b/iii/g; | |||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 1946 | ▶ | print "ROMAN 4: $roman\n" if $self->verbose; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 1946 | return $roman; | |||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 1946 | ▶ | sub get_scale_mode { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_scale_mode: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 1946 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 1946 | my @scale = qw( I ii iii IV V vi vii ); # Default to major/ionian | |||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 1946 | ▶ | if ( $self->scale_name eq 'dorian' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 126 | @scale = qw( i ii III IV v vi VII ); | |||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 231 | elsif ( $self->scale_name eq 'phrygian' ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 126 | @scale = qw( i II III iv v VI vii ); | |||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 234 | elsif ( $self->scale_name eq 'lydian' ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 126 | @scale = qw( I II iii iv V vi vii ); | |||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 237 | elsif ( $self->scale_name eq 'mixolydian' ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 126 | @scale = qw( I ii iii IV v vi VII ); | |||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 240 | ▶ | elsif ( $self->scale_name eq 'minor' || $self->scale_name eq 'aeolian' ) { | |||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->scale_name eq "minor" or $self->scale_name eq "aeolian"
MC/DC50%1/2
$self->scale_name eq "minor" or $self->scale_name eq "aeolian"
$self->scale_name eq "minor"
$self->scale_name eq "aeolian"
Truth table66%2/3
A or B
A= $self->scale_name eq "minor"B= $self->scale_name eq "aeolian"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 128 | @scale = qw( i ii III iv v VI VII ); | |||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 243 | elsif ( $self->scale_name eq 'locrian' ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 126 | @scale = qw( i II iii iv V VI vii ); | |||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 1946 | return @scale; | |||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 21 | ▶ | sub get_scale_degree { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_scale_degree: called CC=9 SCAR=22.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 21 | my ($self, $roman) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 253 | 21 | my $degree = 1; # Default to major/ionian | |||||||||||||||||||||||||||||||||||||||||||||
| 254 | 21 | my $type = 'major'; | |||||||||||||||||||||||||||||||||||||||||||||
| 255 | 21 | ▶ | if ( $roman =~ /^vii/i ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 3 | $degree = 7; | |||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 258 | elsif ( $roman =~ /^vi/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 3 | $degree = 6; | |||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 261 | elsif ( $roman =~ /^v/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 3 | $degree = 5; | |||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 264 | elsif ( $roman =~ /^iv/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 3 | $degree = 4; | |||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 267 | elsif ( $roman =~ /^iii/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 3 | $degree = 3; | |||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 270 | elsif ( $roman =~ /^ii/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 3 | $degree = 2; | |||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 21 | ▶ | if ( $roman =~ /o$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 7 | $type = 'diminished'; | |||||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 276 | elsif ( $roman =~ /^[iv]+$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 7 | $type = 'minor'; | |||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 21 | return $degree, $type; | |||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | ▶ | sub get_scale_chords { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_scale_chords: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | my %diminished = ( | |||||||||||||||||||||||||||||||||||||||||||||
| 287 | major => 'vii', | ||||||||||||||||||||||||||||||||||||||||||||||
| 288 | ionian => 'vii', | ||||||||||||||||||||||||||||||||||||||||||||||
| 289 | dorian => 'vi', | ||||||||||||||||||||||||||||||||||||||||||||||
| 290 | phrygian => 'v', | ||||||||||||||||||||||||||||||||||||||||||||||
| 291 | lydian => 'iv', | ||||||||||||||||||||||||||||||||||||||||||||||
| 292 | mixolydian => 'iii', | ||||||||||||||||||||||||||||||||||||||||||||||
| 293 | minor => 'ii', | ||||||||||||||||||||||||||||||||||||||||||||||
| 294 | aeolian => 'ii', | ||||||||||||||||||||||||||||||||||||||||||||||
| 295 | locrian => 'i', | ||||||||||||||||||||||||||||||||||||||||||||||
| 296 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | my @chords = map { m/^$diminished{ $self->scale_name }$/ ? 'dim' : m/^[A-Z]+$/ ? '' : 'm' } $self->get_scale_mode; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | return @chords; | |||||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 2034 | ▶ | sub _up_to_flat { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_up_to_flat: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 2034 | my ($numeral, $roman) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||
| 305 | # Change a roman sharp to a flat of the succeeding scale position | ||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 2034 | ▶ | $numeral =~ s/#([IV]+)/b$roman->[ ( ( first_index { lc($1) eq lc($_) } @$roman ) + 1 ) % @$roman ]/i; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 2034 | return $numeral; | |||||||||||||||||||||||||||||||||||||||||||||
| 309 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 440 | ▶ | sub _pos_acc { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_pos_acc: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 440 | my ( $note, $position, $notes ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 440 | my $accidental; | |||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||
| 316 | # If the note has no accidental... | ||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 440 | ▶ | if ( length($note) == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 318 | # Find the scale position of the closest similar note | ||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 265 | ▶ | $position = first_index { $_ =~ /^$note/ } @$notes; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||
| 321 | # Get the accidental of the scale note | ||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 265 | ( $accidental = $notes->[$position] ) =~ s/^[A-G](.)$/$1/; | |||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||
| 324 | # TODO: Explain why. | ||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 265 | ▶ | $accidental = $accidental eq '#' ? 'b' : '#'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 327 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 328 | # Enharmonic double sharp equivalents | ||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 175 | my %previous_enharmonics = ( | |||||||||||||||||||||||||||||||||||||||||||||
| 330 | 'C#' => 'C##', | ||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 'Db' => 'C##', | ||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 'F#' => 'F##', | ||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 'Gb' => 'F##', | ||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 'G#' => 'G##', | ||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 'Ab' => 'G##', | ||||||||||||||||||||||||||||||||||||||||||||||
| 336 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 337 | $note = $previous_enharmonics{$note} | ||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 175 | ▶ | if exists $previous_enharmonics{$note} && any { $_ =~ /[CFG]##/ } @$notes; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
Condition100%3/3
exists $previous_enharmonics{$note} and &any(sub {
$_ =~ /[CFG]##/;
}
, @$notes)
MC/DC100%2/2
exists $previous_enharmonics{$note} and &any(sub {
$_ =~ /[CFG]##/;
}
, @$notes)
exists $previous_enharmonics{$note}
&any(sub {
$_ =~ /[CFG]##/;
}
, @$notes)
Truth table100%3/3
A and B
A= exists $previous_enharmonics{$note}B= &any(sub {
$_ =~ /[CFG]##/;
}
, @$notes)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||
| 340 | # Get the accidental of the given note | ||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 175 | ( my $letter, $accidental ) = $note =~ /^([A-G])(.+)$/; | |||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||
| 343 | # Get the scale position of the closest similar note | ||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 175 | ▶ | $position = first_index { $_ =~ /^$letter/ } @$notes; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 175 | ▶ | $accidental = $accidental eq '##' ? 'b' : $accidental; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 440 | return $position, $accidental; | |||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 302 | ▶ | sub _valid_note { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_valid_note: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 302 | my ($note) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 302 | my @valid = (); | |||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 302 | my @notes = 'A' .. 'G'; | |||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 302 | push @valid, @notes; | |||||||||||||||||||||||||||||||||||||||||||||
| 360 | 302 | push @valid, map { $_ . '#' } @notes; | |||||||||||||||||||||||||||||||||||||||||||||
| 361 | 302 | push @valid, map { $_ . '##' } @notes; | |||||||||||||||||||||||||||||||||||||||||||||
| 362 | 302 | push @valid, map { $_ . 'b' } @notes; | |||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 302 | ▶ | return any { $_ eq $note } @valid; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 151 | ▶ | sub _valid_scale { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_valid_scale: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 151 | my ($name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 151 | my @valid = qw( | |||||||||||||||||||||||||||||||||||||||||||||
| 371 | ionian | ||||||||||||||||||||||||||||||||||||||||||||||
| 372 | major | ||||||||||||||||||||||||||||||||||||||||||||||
| 373 | dorian | ||||||||||||||||||||||||||||||||||||||||||||||
| 374 | phrygian | ||||||||||||||||||||||||||||||||||||||||||||||
| 375 | lydian | ||||||||||||||||||||||||||||||||||||||||||||||
| 376 | mixolydian | ||||||||||||||||||||||||||||||||||||||||||||||
| 377 | aeolian | ||||||||||||||||||||||||||||||||||||||||||||||
| 378 | minor | ||||||||||||||||||||||||||||||||||||||||||||||
| 379 | locrian | ||||||||||||||||||||||||||||||||||||||||||||||
| 380 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 151 | ▶ | return any { $_ eq $name } @valid; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 18 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||
| 387 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||