Piano Frequencies
Stephen Lukacs (2) iquanta.org/instruct/python
| key | note | f (Hz) | f Tesla (Hz) |
|---|---|---|---|
| 88 | C8 | 4186.00904 | 4109.89979 |
| 87 | B7 | 3951.06641 | 3879.22884 |
| 86 | A#7/B♭7 | 3729.31009 | 3661.50445 |
| 85 | A7 | 3520.0 | 3456.0 |
| 84 | G#7/A♭7 | 3322.43758 | 3262.02962 |
| 83 | G7 | 3135.96349 | 3078.94597 |
| 82 | F#7/G♭7 | 2959.95538 | 2906.13801 |
| 81 | F7 | 2793.82585 | 2743.02902 |
| 80 | E7 | 2637.02046 | 2589.07463 |
| 79 | D#7/E♭7 | 2489.01587 | 2443.76104 |
| 78 | D7 | 2349.31814 | 2306.60327 |
| 77 | C#7/D♭7 | 2217.46105 | 2177.14357 |
| 76 | C7 | 2093.00452 | 2054.94989 |
| 75 | B6 | 1975.53321 | 1939.61442 |
| 74 | A#6/B♭6 | 1864.65505 | 1830.75223 |
| 73 | A6 | 1760.0 | 1728.0 |
| 72 | G#6/A♭6 | 1661.21879 | 1631.01481 |
| 71 | G6 | 1567.98174 | 1539.47298 |
| 70 | F#6/G♭6 | 1479.97769 | 1453.06901 |
| 69 | F6 | 1396.91293 | 1371.51451 |
| 68 | E6 | 1318.51023 | 1294.53731 |
| 67 | D#6/E♭6 | 1244.50793 | 1221.88052 |
| 66 | D6 | 1174.65907 | 1153.30163 |
| 65 | C#6/D♭6 | 1108.73052 | 1088.57179 |
| 64 | C6 | 1046.50226 | 1027.47495 |
| 63 | B5 | 987.7666 | 969.80721 |
| 62 | A#5/B♭5 | 932.32752 | 915.37611 |
| 61 | A5 | 880.0 | 864.0 |
| 60 | G#5/A♭5 | 830.6094 | 815.50741 |
| 59 | G5 | 783.99087 | 769.73649 |
| 58 | F#5/G♭5 | 739.98885 | 726.5345 |
| 57 | F5 | 698.45646 | 685.75725 |
| 56 | E5 | 659.25511 | 647.26866 |
| 55 | D#5/E♭5 | 622.25397 | 610.94026 |
| 54 | D5 | 587.32954 | 576.65082 |
| 53 | C#5/D♭5 | 554.36526 | 544.28589 |
| 52 | C5 | 523.25113 | 513.73747 |
| 51 | B4 | 493.8833 | 484.9036 |
| 50 | A#4/B♭4 | 466.16376 | 457.68806 |
| 49 | A4 | 440.0 | 432.0 |
| 48 | G#4/A♭4 | 415.3047 | 407.7537 |
| 47 | G4 | 391.99544 | 384.86825 |
| 46 | F#4/G♭4 | 369.99442 | 363.26725 |
| 45 | F4 | 349.22823 | 342.87863 |
| 44 | E4 | 329.62756 | 323.63433 |
| 43 | D#4/E♭4 | 311.12698 | 305.47013 |
| 42 | D4 | 293.66477 | 288.32541 |
| 41 | C#4/D♭4 | 277.18263 | 272.14295 |
| 40 | C4 | 261.62557 | 256.86874 |
| 39 | B3 | 246.94165 | 242.4518 |
| 38 | A#3/B♭3 | 233.08188 | 228.84403 |
| 37 | A3 | 220.0 | 216.0 |
| 36 | G#3/A♭3 | 207.65235 | 203.87685 |
| 35 | G3 | 195.99772 | 192.43412 |
| 34 | F#3/G♭3 | 184.99721 | 181.63363 |
| 33 | F3 | 174.61412 | 171.43931 |
| 32 | E3 | 164.81378 | 161.81716 |
| 31 | D#3/E♭3 | 155.56349 | 152.73506 |
| 30 | D3 | 146.83238 | 144.1627 |
| 29 | C#3/D♭3 | 138.59132 | 136.07147 |
| 28 | C3 | 130.81278 | 128.43437 |
| 27 | B2 | 123.47083 | 121.2259 |
| 26 | A#2/B♭2 | 116.54094 | 114.42201 |
| 25 | A2 | 110.0 | 108.0 |
| 24 | G#2/A♭2 | 103.82617 | 101.93843 |
| 23 | G2 | 97.99886 | 96.21706 |
| 22 | F#2/G♭2 | 92.49861 | 90.81681 |
| 21 | F2 | 87.30706 | 85.71966 |
| 20 | E2 | 82.40689 | 80.90858 |
| 19 | D#2/E♭2 | 77.78175 | 76.36753 |
| 18 | D2 | 73.41619 | 72.08135 |
| 17 | C#2/D♭2 | 69.29566 | 68.03574 |
| 16 | C2 | 65.40639 | 64.21718 |
| 15 | B1 | 61.73541 | 60.61295 |
| 14 | A#1/B♭1 | 58.27047 | 57.21101 |
| 13 | A1 | 55.0 | 54.0 |
| 12 | G#1/A♭1 | 51.91309 | 50.96921 |
| 11 | G1 | 48.99943 | 48.10853 |
| 10 | F#1/G♭1 | 46.2493 | 45.40841 |
| 9 | F1 | 43.65353 | 42.85983 |
| 8 | E1 | 41.20344 | 40.45429 |
| 7 | D#1/E♭1 | 38.89087 | 38.18377 |
| 6 | D1 | 36.7081 | 36.04068 |
| 5 | C#1/D♭1 | 34.64783 | 34.01787 |
| 4 | C1 | 32.7032 | 32.10859 |
| 3 | B0 | 30.86771 | 30.30648 |
| 2 | A#0/B♭0 | 29.13524 | 28.6055 |
| 1 | A0 | 27.5 | 27.0 |
{"data":[{"marker":{"color":"DarkGray"},"mode":"markers","name":"tesla","x":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88],"y":[27.0,28.6055,30.30648,32.10859,34.01787,36.04068,38.18377,40.45429,42.85983,45.40841,48.10853,50.96921,54.0,57.21101,60.61295,64.21718,68.03574,72.08135,76.36753,80.90858,85.71966,90.81681,96.21706,101.93843,108.0,114.42201,121.2259,128.43437,136.07147,144.1627,152.73506,161.81716,171.43931,181.63363,192.43412,203.87685,216.0,228.84403,242.4518,256.86874,272.14295,288.32541,305.47013,323.63433,342.87863,363.26725,384.86825,407.7537,432.0,457.68806,484.9036,513.73747,544.28589,576.65082,610.94026,647.26866,685.75725,726.5345,769.73649,815.50741,864.0,915.37611,969.80721,1027.47495,1088.57179,1153.30163,1221.88052,1294.53731,1371.51451,1453.06901,1539.47298,1631.01481,1728.0,1830.75223,1939.61442,2054.94989,2177.14357,2306.60327,2443.76104,2589.07463,2743.02902,2906.13801,3078.94597,3262.02962,3456.0,3661.50445,3879.22884,4109.89979],"type":"scatter"},{"marker":{"color":"Black"},"mode":"markers","name":"notes","x":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88],"y":[27.5,29.13524,30.86771,32.7032,34.64783,36.7081,38.89087,41.20344,43.65353,46.2493,48.99943,51.91309,55.0,58.27047,61.73541,65.40639,69.29566,73.41619,77.78175,82.40689,87.30706,92.49861,97.99886,103.82617,110.0,116.54094,123.47083,130.81278,138.59132,146.83238,155.56349,164.81378,174.61412,184.99721,195.99772,207.65235,220.0,233.08188,246.94165,261.62557,277.18263,293.66477,311.12698,329.62756,349.22823,369.99442,391.99544,415.3047,440.0,466.16376,493.8833,523.25113,554.36526,587.32954,622.25397,659.25511,698.45646,739.98885,783.99087,830.6094,880.0,932.32752,987.7666,1046.50226,1108.73052,1174.65907,1244.50793,1318.51023,1396.91293,1479.97769,1567.98174,1661.21879,1760.0,1864.65505,1975.53321,2093.00452,2217.46105,2349.31814,2489.01587,2637.02046,2793.82585,2959.95538,3135.96349,3322.43758,3520.0,3729.31009,3951.06641,4186.00904],"type":"scatter"}],"layout":{"template":{"data":{"histogram2dcontour":[{"type":"histogram2dcontour","colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]}],"choropleth":[{"type":"choropleth","colorbar":{"outlinewidth":0,"ticks":""}}],"histogram2d":[{"type":"histogram2d","colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]}],"heatmap":[{"type":"heatmap","colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]}],"contourcarpet":[{"type":"contourcarpet","colorbar":{"outlinewidth":0,"ticks":""}}],"contour":[{"type":"contour","colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]}],"surface":[{"type":"surface","colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]}],"mesh3d":[{"type":"mesh3d","colorbar":{"outlinewidth":0,"ticks":""}}],"scatter":[{"fillpattern":{"fillmode":"overlay","size":10,"solidity":0.2},"type":"scatter"}],"parcoords":[{"type":"parcoords","line":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scatterpolargl":[{"type":"scatterpolargl","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"bar":[{"error_x":{"color":"#2a3f5f"},"error_y":{"color":"#2a3f5f"},"marker":{"line":{"color":"#E5ECF6","width":0.5},"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"bar"}],"scattergeo":[{"type":"scattergeo","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scatterpolar":[{"type":"scatterpolar","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"histogram":[{"marker":{"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"histogram"}],"scattergl":[{"type":"scattergl","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scatter3d":[{"type":"scatter3d","line":{"colorbar":{"outlinewidth":0,"ticks":""}},"marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scattermap":[{"type":"scattermap","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scattermapbox":[{"type":"scattermapbox","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scatterternary":[{"type":"scatterternary","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scattercarpet":[{"type":"scattercarpet","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"carpet":[{"aaxis":{"endlinecolor":"#2a3f5f","gridcolor":"white","linecolor":"white","minorgridcolor":"white","startlinecolor":"#2a3f5f"},"baxis":{"endlinecolor":"#2a3f5f","gridcolor":"white","linecolor":"white","minorgridcolor":"white","startlinecolor":"#2a3f5f"},"type":"carpet"}],"table":[{"cells":{"fill":{"color":"#EBF0F8"},"line":{"color":"white"}},"header":{"fill":{"color":"#C8D4E3"},"line":{"color":"white"}},"type":"table"}],"barpolar":[{"marker":{"line":{"color":"#E5ECF6","width":0.5},"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"barpolar"}],"pie":[{"automargin":true,"type":"pie"}]},"layout":{"autotypenumbers":"strict","colorway":["#636efa","#EF553B","#00cc96","#ab63fa","#FFA15A","#19d3f3","#FF6692","#B6E880","#FF97FF","#FECB52"],"font":{"color":"#2a3f5f"},"hovermode":"closest","hoverlabel":{"align":"left"},"paper_bgcolor":"white","plot_bgcolor":"#E5ECF6","polar":{"bgcolor":"#E5ECF6","angularaxis":{"gridcolor":"white","linecolor":"white","ticks":""},"radialaxis":{"gridcolor":"white","linecolor":"white","ticks":""}},"ternary":{"bgcolor":"#E5ECF6","aaxis":{"gridcolor":"white","linecolor":"white","ticks":""},"baxis":{"gridcolor":"white","linecolor":"white","ticks":""},"caxis":{"gridcolor":"white","linecolor":"white","ticks":""}},"coloraxis":{"colorbar":{"outlinewidth":0,"ticks":""}},"colorscale":{"sequential":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"sequentialminus":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"diverging":[[0,"#8e0152"],[0.1,"#c51b7d"],[0.2,"#de77ae"],[0.3,"#f1b6da"],[0.4,"#fde0ef"],[0.5,"#f7f7f7"],[0.6,"#e6f5d0"],[0.7,"#b8e186"],[0.8,"#7fbc41"],[0.9,"#4d9221"],[1,"#276419"]]},"xaxis":{"gridcolor":"white","linecolor":"white","ticks":"","title":{"standoff":15},"zerolinecolor":"white","automargin":true,"zerolinewidth":2},"yaxis":{"gridcolor":"white","linecolor":"white","ticks":"","title":{"standoff":15},"zerolinecolor":"white","automargin":true,"zerolinewidth":2},"scene":{"xaxis":{"backgroundcolor":"#E5ECF6","gridcolor":"white","linecolor":"white","showbackground":true,"ticks":"","zerolinecolor":"white","gridwidth":2},"yaxis":{"backgroundcolor":"#E5ECF6","gridcolor":"white","linecolor":"white","showbackground":true,"ticks":"","zerolinecolor":"white","gridwidth":2},"zaxis":{"backgroundcolor":"#E5ECF6","gridcolor":"white","linecolor":"white","showbackground":true,"ticks":"","zerolinecolor":"white","gridwidth":2}},"shapedefaults":{"line":{"color":"#2a3f5f"}},"annotationdefaults":{"arrowcolor":"#2a3f5f","arrowhead":0,"arrowwidth":1},"geo":{"bgcolor":"white","landcolor":"#E5ECF6","subunitcolor":"white","showland":true,"showlakes":true,"lakecolor":"white"},"title":{"x":0.05},"mapbox":{"style":"light"}}},"yaxis":{"title":{"text":"Frequency (Hz)"},"anchor":"x","side":"left"},"xaxis":{"title":{"text":"key"}},"title":{"text":"Piano Frequency Response per Key"},"width":880,"height":640,"margin":{"b":60,"l":25,"pad":0,"r":25,"t":60},"plot_bgcolor":"#f5f5f5","paper_bgcolor":"White"}}
"""
reference: https://iquanta.org/instruct/python ::: Piano: Frequencies of Notes ::: Stephen Lukacs, Ph.D. ©2023-03-22
"""
<page_scripts>
<style>
table.notes { width: 200px; }
table.notes td { padding: 2px 8px; }
table.notes tr:nth-child(12n+2) td { border: 2px solid gray; border-radius: 5px; }
table.notes tr:nth-child(12n+5) td { border: 2px solid pink; border-radius: 5px; }
</style>
</page_scripts>
from yatl.helpers import *
import plotly.graph_objects as go
BR = TAG['br/']
rtn = DIV()
if 1:
html = { '':"♮", '-':"♮", '_':"♭", '^':"♯", '#':"♯" }
octave = ['A', 'A#/B_', 'B', 'C', 'C#/D_', 'D', 'D#/E_', 'E', 'F', 'F#/G_', 'G', 'G#/A_']
for i, o in enumerate(octave):
xx = o.find('/')
if (xx > -1):
octave[i] = o[:xx]+"~"+'/<span class="flat">'+o[xx+1]+html["_"]+"</span>~"
else:
octave[i] = o+"~"
Hz440 = lambda n: round(440.*(2**((n-49)/12.)), 5)
Hz432 = lambda n: round(432.*(2**((n-49)/12.)), 5)
nth_octave, ith_octave = 8, 3
snth_octave = str(nth_octave)
t = TABLE(TR(TH("key"), TH("note"), TH("f (Hz)"), TH("f Tesla (Hz)"),), _class="notes")
for n in range(88, 0, -1):
try:
key = XML(octave[ith_octave].replace('~', snth_octave))
except Exception as E:
rtn.append(E)
t.append(TR(TD(n), TD(key), TD(Hz440(n)), TD(Hz432(n))))
ith_octave -= 1
if (ith_octave < 0):
ith_octave = 11
if (ith_octave == 2):
nth_octave -= 1
snth_octave = str(nth_octave)
rtn.append(DIV(t, _style="float:left;"))
fig = go.Figure()
fig.add_trace(go.Scatter(x=[ i for i in range(1, 89) ], y=[ Hz432(i) for i in range(1, 89) ], mode='markers', name="tesla", marker=go.scatter.Marker(color="DarkGray")))
fig.add_trace(go.Scatter(x=[ i for i in range(1, 89) ], y=[ Hz440(i) for i in range(1, 89) ], mode='markers', name="notes", marker=go.scatter.Marker(color="Black")))
fig.update_layout(xaxis=go.XAxis(title="key"), yaxis=go.YAxis(title="Frequency (Hz)", anchor='x', side='left'))
fig.update_layout(title_text="Piano Frequency Response per Key", width=880, height=640, margin=go.layout.Margin(l=25, r=25, b=60, t=60, pad=0), plot_bgcolor="#f5f5f5", paper_bgcolor="White")
rtn.append(CAT(DIV(XML(fig.to_json()), _id="figure0"),))
rtn.append(DIV(_style="float:none; clear:both;"))