line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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
|
|
|
4
|
|
121902
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
200
|
|
7
|
4
|
|
|
4
|
|
24
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
2533
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.06'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub pv { |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# use Guitar::Scale; |
14
|
|
|
|
|
|
|
# print Guitar::Scale::pv('E', 'Chromatic'); |
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
# |
17
|
3
|
|
|
3
|
0
|
32
|
my ($_key, $_t, $mode) = @_; |
18
|
3
|
|
50
|
|
|
147
|
$_t ||= 'Minor'; |
19
|
3
|
|
|
|
|
190
|
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
|
|
|
|
|
19
|
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
|
3
|
50
|
|
|
|
15
|
if ($_t =~ /^2\d{11}$/) { $type{$_t} = $_t } |
|
0
|
|
|
|
|
0
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# make scale |
64
|
3
|
|
|
|
|
8
|
my $st = 0; |
65
|
3
|
|
|
|
|
12
|
for my $s ( 0 .. $#key ){ |
66
|
15
|
100
|
|
|
|
220
|
if ($_key =~ /^$key[$s]$/i) { $st = $s; last } |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
7
|
|
67
|
|
|
|
|
|
|
} |
68
|
3
|
|
|
|
|
23
|
my $col = substr(substr($type{$_t}, 12-$st, $st).$type{$_t} ,0 ,12) x 4; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# print scale |
71
|
|
|
|
|
|
|
my |
72
|
3
|
|
|
|
|
11
|
$str = substr($col, 0, 25). "\n"; |
73
|
3
|
|
|
|
|
10
|
$str .= substr($col, 7, 25). "\n"; |
74
|
3
|
|
|
|
|
12
|
$str .= substr($col, 3, 25). "\n"; |
75
|
3
|
|
|
|
|
11
|
$str .= substr($col, 10, 25). "\n"; |
76
|
3
|
|
|
|
|
9
|
$str .= substr($col, 5, 25). "\n"; |
77
|
3
|
|
|
|
|
10
|
$str .= substr($col, 0, 25). "\n"; |
78
|
3
|
50
|
|
|
|
13
|
$mode || do { |
79
|
0
|
|
|
|
|
0
|
$str =~ s/0/--+/g; |
80
|
0
|
|
|
|
|
0
|
$str =~ s/1/<>+/g; |
81
|
0
|
|
|
|
|
0
|
$str =~ s/2/[]+/g;# bass key |
82
|
0
|
|
|
|
|
0
|
for my $i ( 0 .. 24 ){ $str .= sprintf("%02d ", $i) } |
|
0
|
|
|
|
|
0
|
|
83
|
|
|
|
|
|
|
}; |
84
|
3
|
|
|
|
|
32
|
return $str; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |