Overtones

2003/3/23 Takuichi Hirano

周波数を求める関数（平均律）

[Input]
オクターブ
音 (c,c#,d,d#,e,f,f#,g,g#,a,a#,b)

ABCToNumOfHalfTone[ABC_] := 
          Which[
ABC == "C"  ||  ABC == "c", 
            0, 
ABC == "C#"  ||  ABC == "c#", 
            1, 
ABC == "D"  ||  ABC == "d", 
            2, 
ABC == "D#"  ||  ABC == "d#", 
            3, 
ABC == "E"  ||  ABC == "e", 
            4, 
ABC == "F"  ||  ABC == "f", 
            5, 
ABC == "F#"  ||  ABC == "f#", 
            6, 
ABC == "G"  ||  ABC == "g", 
            7, 
ABC == "G#"  ||  ABC == "g#", 
            8, 
ABC == "A"  ||  ABC == "a", 
            9, 
ABC == "A#"  ||  ABC == "a#", 
            10, 
ABC == "B"  ||  ABC == "b", 
            11];

FreqTemperament[Octave_, ABC_]:=Module[{r = (2^(1/12))},
  
ABCNum = 
              ABCToNumOfHalfTone[
                ABC]; 
(440*(r^((Octave - 4)*12)))*
                (r^(ABCNum - 9))  // N
];

Harmonic

n = 10;
fs = FreqTemperament[4, "c"];
f1 = FreqTemperament[4, "c"]/fs;
f2 = FreqTemperament[4, "e"]/fs;
f3 = FreqTemperament[4, "g"]/fs;
Table[fc*i, {i, 1, 10}]/fc;
Table[fe*i, {i, 1, 10}]/fc;
SpectoralBar[f0_, n_, vscale_, Col_] := 
        Module[{}, 
{Table[{Col, 
                Line[{{f0*i, 0}, {f0*i, vscale}}]}, {i, 1, 
                n}]}
];
\(\(Show[
        Graphics[{
{
SpectoralBar[f1, n, 
                1, RGBColor[1, 0, 0]], 
SpectoralBar[f2, n, 
                0.75, RGBColor[0, 0, 1]], 
SpectoralBar[f3, 
                n, 0.5, 
                RGBColor[0, 1, 
                  0]]
}, 
{
Text[
                StyleForm["C", FontColor -> RGBColor[1, 1, 1], 
                  Background -> RGBColor[1, 0, 0], FontSize -> 32, 
                  FontWeight -> "Bold"], {f1, \((1 + 0.75)\)/2}, {0, 
                  0}, {1, 0}], 
Text[
                StyleForm["E", FontColor -> RGBColor[1, 1, 1], 
                  Background -> RGBColor[0, 0, 1], FontSize -> 32, 
                  FontWeight -> "Bold"], {f2, \((0.75 + 0.5)\)/
                    2}, {0, 0}, {1, 0}], 
Text[
                StyleForm["G", FontColor -> RGBColor[1, 1, 1], 
                  Background -> RGBColor[0, 1, 0], FontSize -> 32, 
                  FontWeight -> "Bold"], {f3, \((0.5 + 0.25)\)/
                    2}, {0, 0}, {1, 
                  0}]
}
}], 
PlotRange -> {{0, Min[f1*n, f2*n]}, {0, 
              Automatic}}, 
TextStyle -> {FontSize -> 16}, 
Frame -> 
          True, 
FrameTicks -> {Table[
              i, {i, 0, 
                IntegerPart[
                  Min[f1*n, 
                    f2*n]]}], {}, {}, {}}, 
FrameLabel -> {"Normalized frequency", ""}
];\)\)

周波数を求める関数（純正律）

基準周波数は平均律で決める。
基準音から２オクターブ分までサポート

[Input]
基準音のオクターブと音名
と
オクターブ
音 (c,c#,d,d#,e,f,f#,g,g#,a,a#,b)

FreqJustIntonation[OctaveStd_, ABCStd_, Octave_, ABC_]:=Module[{r = (2^(1/12))},
  
ABCStdNum = 
              ABCToNumOfHalfTone[ABCStd]; 
ABCNum = 
              ABCToNumOfHalfTone[
                ABC]; 
JustIntFracList = {1, (16/15), (9/8), 
                (13/11), (5/4), (4/3), (7/5), (3/2), (8/5), (5/3), (16/9), (15/8), 2, 
                (15/7), (9/4), (12/5), (5/2), (8/3), (14/5), 3, (16/5), (10/3), (7/2), 
                (15/4)}; 
DiffHalfTone = ((12*Octave + 
                      ABCNum) - (12*OctaveStd + 
                      ABCStdNum)); 
(27.5*(2^OctaveStd)*(r^(ABCStdNum - 9)))*
                JustIntFracList[[Mod[DiffHalfTone, 12] + 
                      1]]*(2^Quotient)[DiffHalfTone, 12]  // N
];

Harmonic

n = 10;
fs = 
        FreqJustIntonation[4, "c", 
          4, "c"];
f1 = 
        FreqJustIntonation[4, "c", 4, "c"]/
          fs;
f2 = 
        FreqJustIntonation[4, "c", 4, "e"]/
          fs;
f3 = 
        FreqJustIntonation[4, "c", 4, "g"]/
          fs;
Table[fc*i, {i, 1, 10}]/fc;
Table[fe*i, {i, 1, 10}]/fc;
SpectoralBar[f0_, n_, vscale_, Col_] := 
        Module[{}, 
{Table[{Col, 
                Line[{{f0*i, 0}, {f0*i, vscale}}]}, {i, 1, 
                n}]}
];
\(\(Show[
        Graphics[{
{
SpectoralBar[f1, n, 
                1, RGBColor[1, 0, 0]], 
SpectoralBar[f2, n, 
                0.75, RGBColor[0, 0, 1]], 
SpectoralBar[f3, 
                n, 0.5, 
                RGBColor[0, 1, 
                  0]]
}, 
{
Text[
                StyleForm["C", FontColor -> RGBColor[1, 1, 1], 
                  Background -> RGBColor[1, 0, 0], FontSize -> 32, 
                  FontWeight -> "Bold"], {f1, \((1 + 0.75)\)/2}, {0, 
                  0}, {1, 0}], 
Text[
                StyleForm["E", FontColor -> RGBColor[1, 1, 1], 
                  Background -> RGBColor[0, 0, 1], FontSize -> 32, 
                  FontWeight -> "Bold"], {f2, \((0.75 + 0.5)\)/
                    2}, {0, 0}, {1, 0}], 
Text[
                StyleForm["G", FontColor -> RGBColor[1, 1, 1], 
                  Background -> RGBColor[0, 1, 0], FontSize -> 32, 
                  FontWeight -> "Bold"], {f3, \((0.5 + 0.25)\)/
                    2}, {0, 0}, {1, 
                  0}]
}
}], 
PlotRange -> {{0, Min[f1*n, f2*n]}, {0, 
              Automatic}}, 
TextStyle -> {FontSize -> 16}, 
Frame -> 
          True, 
FrameTicks -> {Table[
              i, {i, 0, 
                IntegerPart[
                  Min[f1*n, 
                    f2*n]]}], {}, {}, {}}, 
FrameLabel -> {"Normalized frequency", ""}
];\)\)

周波数比 根音: 第3音: 第5音=1 : (5/4) : (3/2)

[根音の5倍音と第3音の5倍音の周波数は同じになる]
同じ周波数になる根音と第3音の倍音の数をそれぞれm,nとおくと
1  m = (5/4) n
4  m = 5  n
よって、
m = 5  l,  n = 4  l (lは任意の整数)
ならば周波数が一致する。その物理的意味を持つ最小値はl=1のときであり
m=5, n=4
となるから証明された。