調 (Key)

2003/3/16 平野拓一（東京工業大学）
Takuichi Hirano (Tokyo Institute of Technology)

Define Rotate Function

自然短音階 (natural minor scale)

\(PrintNoteInterval[WHToneNoteList_] := 
          Module[{}, 
gnotelis = 
              Table[{{AbsoluteThickness[2], 
                    Line[{{\((i - 1)\) - 1/2, \(-1\)/2}, {\((i - 1)\) + 
                            1/2, \(-1\)/2}, {\((i - 1)\) + 1/2, 
                          1/2}, {\((i - 1)\) - 1/2, 
                          1/2}, {\((i - 1)\) - 1/2, \(-1\)/
                            2}}]}, 
Text[
                    StyleForm[WHToneNoteList[\([1, i]\)], 
                      FontSize -> 14, 
                      FontWeight -> "Bold"], {i - 1, 0}, {0, 0}, {1, 
                      0}]}, {i, 1, 
                  Length[WHToneNoteList[\([2]\)]]}]; 
gintervallis = 
              Table[Text[
                  StyleForm[WHToneNoteList[\([2, i]\)], FontSize -> 14, 
                    FontWeight -> "Bold"], {i - 1 + 1/2, 1}, {0, 
                    0}, {1, 0}], {i, 1, 
                  Length[WHToneNoteList[\([1]\)]]}]; 
Show[
              Graphics[{gnotelis, 
                  gintervallis}], 
PlotRange -> 
                All, 
AspectRatio -> 
                Automatic]
];\)

ApplySharp[Note_]:=Module[{},
  
\(If[
              StringTake[
                  Note, \(-1\)] == "♭", 
StringTake[
                Note, {1, 
                  StringLength[Note] - 
                    1}], 
Note\  <> \ "♯"
]\)
];
ApplyFlat[Note_]:=Module[{},
  
\(If[
                StringTake[
                    Note, \(-1\)] == "♯", 
StringTake[
                  Note, {1, 
                    StringLength[Note] - 
                      1}], 
Note\  <> \ "♭"
]\)
];

ApplySharpInScale[NoteWHToneList_, n_]:=Module[{lis = NoteWHToneList},
  
lis = 
              ReplacePart[lis, 
                ApplySharp[lis[[1, n]] ], {1, 
                  n}]; 
lis = 
              ReplacePart[lis, 
                lis[[2, n - 1]] + 1, {2, 
                  n - 1}]; 
lis = 
              ReplacePart[lis, 
                lis[[2, n]] - 1, {2, n}]; 
lis
];
ApplyFlatInScale[NoteWHToneList_, n_]:=Module[{lis = NoteWHToneList},
  
lis = 
                ReplacePart[lis, 
                  ApplyFlat[lis[[1, n]] ], {1, 
                    n}]; 
lis = 
                ReplacePart[lis, 
                  lis[[2, n - 1]] - 1, {2, 
                    n - 1}]; 
lis = 
                ReplacePart[lis, 
                  lis[[2, n]] + 1, {2, n}]; 
lis
];

\(NextSharpNaturalMinorScale[NoteWHToneList_] := 
          Module[{}, 
LisInitial = {RotateLeft[
                  NoteWHToneList[\([1]\)], 4], 
                RotateLeft[NoteWHToneList[\([2]\)], 
                  4]}; 
Print["**** Initial After RotateLeft[*,4] ****"]; 
PrintNoteInterval[
              LisInitial]; 

Print["**** Modified Minor Scale ****"]; 
LisModified = 
              LisInitial; 
Print["Key: ", 
              LisModified[\([1, 
                  1]\)], " Natural Minor"]; 

LisModified = 
              ApplySharpInScale[LisModified, 
                2]; 

PrintNoteInterval[
              LisModified]; 

LisModified];\)

\(NextFlatNaturalMinorScale[NoteWHToneList_] := 
        Module[{}, 
LisInitial = {RotateRight[
                NoteWHToneList[\([1]\)], 4], 
              RotateRight[NoteWHToneList[\([2]\)], 
                4]}; 
Print["**** Initial After RotateRight[*,4] ****"]; 
PrintNoteInterval[
            LisInitial]; 

Print["**** Modified Minor Scale ****"]; 
LisModified = 
            LisInitial; 
Print["Key: ", 
            LisModified[\([1, 
                1]\)], " Natural Minor"]; 

LisModified = 
            ApplyFlatInScale[LisModified, 
              6]; 

PrintNoteInterval[
            LisModified]; 

LisModified];\)

Sharp Minor

Initial

\(\(WHToneNoteList = {{"A", "B", "C", "D", "E", "F", "G"}, {2, 1, 2, 2, 1, 2, 2}};\)\)
PrintNoteInterval[WHToneNoteList];

1 times

lis1 = NextSharpNaturalMinorScale[WHToneNoteList]

2 times

lis2 = NextSharpNaturalMinorScale[lis1]

3 times

lis3 = NextSharpNaturalMinorScale[lis2]

4 times

lis4 = NextSharpNaturalMinorScale[lis3]

5 times

lis5 = NextSharpNaturalMinorScale[lis4]

6 times

lis6 = NextSharpNaturalMinorScale[lis5]

7 times

lis7 = NextSharpNaturalMinorScale[lis6]

Flat Minor

Initial

\(\(WHToneNoteList = {{"A", "B", "C", "D", "E", "F", "G"}, {2, 1, 2, 2, 1, 2, 2}};\)\)
PrintNoteInterval[WHToneNoteList];

1 times

lis1 = NextFlatNaturalMinorScale[WHToneNoteList]

2 times

lis2 = NextFlatNaturalMinorScale[lis1]

3 times

lis3 = NextFlatNaturalMinorScale[lis2]

4 times

lis4 = NextFlatNaturalMinorScale[lis3]

5 times

lis5 = NextFlatNaturalMinorScale[lis4]

6 times

lis6 = NextFlatNaturalMinorScale[lis5]

7 times

lis7 = NextFlatNaturalMinorScale[lis6]