| 1 | package Guitar::Scale; | ||||||||||||
| 2 | |||||||||||||
| 3 | # Copyright (C) 2013 by Mitsuru Yasuda. All rights reserved. | ||||||||||||
| 4 | # mail bugs, comments and feedback to dsyrtm@cpan.org | ||||||||||||
| 5 | |||||||||||||
| 6 | 4 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 4 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 4 | our $VERSION = '0.06'; | |||||||||||
| 9 | |||||||||||||
| 10 | 3 | ▶ | sub pv { | ||||||||||
|
Subroutine
pv: called CC=7 SCAR=20.8
Pod
undocumented
| |||||||||||||
| 11 | # | ||||||||||||
| 12 | # | ||||||||||||
| 13 | # use Guitar::Scale; | ||||||||||||
| 14 | # print Guitar::Scale::pv('E', 'Chromatic'); | ||||||||||||
| 15 | # | ||||||||||||
| 16 | # | ||||||||||||
| 17 | 3 | my ($_key, $_t, $mode) = @_; | |||||||||||
| 18 | 3 | ▶ | $_t ||= 'Minor'; | ||||||||||
|
Condition50%1/2
$_t ||= "Minor"
MC/DC0%0/1
$_t ||= "Minor"
$_t
Truth table50%1/2
A
A= $_t
| |||||||||||||
| 19 | 3 | my %type = ( | |||||||||||
| 20 | 'MitsuruMetal' => '201011010111', | ||||||||||||
| 21 | 'Aeolian' => '201101011010', | ||||||||||||
| 22 | 'Altered' => '210110111010', | ||||||||||||
| 23 | 'Algerian' => '201101111001', | ||||||||||||
| 24 | 'Blues' => '200101110010', | ||||||||||||
| 25 | 'Blues++' => '200111110111', | ||||||||||||
| 26 | 'Chromatic' => '211111111111', | ||||||||||||
| 27 | 'Diminished' => '201101101101', | ||||||||||||
| 28 | 'Diminish--' => '001001001001', | ||||||||||||
| 29 | 'Dorian' => '201101010110', | ||||||||||||
| 30 | 'Dominant7th' => '201011010110', | ||||||||||||
| 31 | 'Diatonic' => '201010010100', | ||||||||||||
| 32 | 'Egyptian' => '201001010010', | ||||||||||||
| 33 | 'HarmonicMinor' => '201101011001', | ||||||||||||
| 34 | 'Hawaiian' => '201101010101', | ||||||||||||
| 35 | 'Hindu' => '201011011010', | ||||||||||||
| 36 | 'HeavyMetal' => '201101110110', | ||||||||||||
| 37 | 'Ionian' => '201011010101', | ||||||||||||
| 38 | 'Japanese' => '210001100010', | ||||||||||||
| 39 | 'Lydian' => '201010110101', | ||||||||||||
| 40 | 'Minor' => '201101011010', | ||||||||||||
| 41 | 'MelodicMinor' => '201101010101', | ||||||||||||
| 42 | 'Mixolydian' => '201011010110', | ||||||||||||
| 43 | 'Major' => '201011010101', | ||||||||||||
| 44 | 'Pentatonic' => '200101010010', | ||||||||||||
| 45 | 'Phrygian' => '210101011010', | ||||||||||||
| 46 | 'Roumanian' => '201100110110', | ||||||||||||
| 47 | 'Ryukyu' => '200011010001', | ||||||||||||
| 48 | 'Sobaya' => '210001011000', | ||||||||||||
| 49 | 'Spanish' => '210011011010', | ||||||||||||
| 50 | 'Ultralocrian' => '210110101100', | ||||||||||||
| 51 | 'WholeTone' => '201010101010', | ||||||||||||
| 52 | |||||||||||||
| 53 | ); | ||||||||||||
| 54 | 3 | my @key = ( | |||||||||||
| 55 | 'E','F','F#|Gb','G','G#|Ab','A','A#|Bb','B','C','C#|Db','D','D#|Eb' | ||||||||||||
| 56 | ); | ||||||||||||
| 57 | |||||||||||||
| 58 | # | ||||||||||||
| 59 | # your homemade @(^-^)@ | ||||||||||||
| 60 | # | ||||||||||||
| 61 | 0 | ▶ | if ($_t =~ /^2\d{11}$/) { $type{$_t} = $_t } | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 62 | |||||||||||||
| 63 | # make scale | ||||||||||||
| 64 | 3 | my $st = 0; | |||||||||||
| 65 | 3 | for my $s ( 0 .. $#key ){ | |||||||||||
| 66 | 15 | ▶ | if ($_key =~ /^$key[$s]$/i) { $st = $s; last } | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 67 | } | ||||||||||||
| 68 | 3 | my $col = substr(substr($type{$_t}, 12-$st, $st).$type{$_t} ,0 ,12) x 4; | |||||||||||
| 69 | |||||||||||||
| 70 | # print scale | ||||||||||||
| 71 | my | ||||||||||||
| 72 | 3 | $str = substr($col, 0, 25). "\n"; | |||||||||||
| 73 | 3 | $str .= substr($col, 7, 25). "\n"; | |||||||||||
| 74 | 3 | $str .= substr($col, 3, 25). "\n"; | |||||||||||
| 75 | 3 | $str .= substr($col, 10, 25). "\n"; | |||||||||||
| 76 | 3 | $str .= substr($col, 5, 25). "\n"; | |||||||||||
| 77 | 3 | $str .= substr($col, 0, 25). "\n"; | |||||||||||
| 78 | 3 | ▶ | $mode || do { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 79 | 0 | $str =~ s/0/--+/g; | |||||||||||
| 80 | 0 | $str =~ s/1/<>+/g; | |||||||||||
| 81 | 0 | $str =~ s/2/[]+/g;# bass key | |||||||||||
| 82 | 0 | for my $i ( 0 .. 24 ){ $str .= sprintf("%02d ", $i) } | |||||||||||
| 83 | }; | ||||||||||||
| 84 | 3 | return $str; | |||||||||||
| 85 | } | ||||||||||||
| 86 | |||||||||||||
| 87 | __END__ | ||||||||||||