%matplotlib inline
import librosa, librosa.display, numpy, matplotlib.pyplot as plt, IPython.display as ipd
plt.style.use('seaborn-muted')
plt.rcParams['figure.figsize'] = (14, 5)
plt.rcParams['axes.grid'] = True
plt.rcParams['axes.spines.left'] = False
plt.rcParams['axes.spines.right'] = False
plt.rcParams['axes.spines.bottom'] = False
plt.rcParams['axes.spines.top'] = False
plt.rcParams['axes.xmargin'] = 0
plt.rcParams['axes.ymargin'] = 0
plt.rcParams['image.cmap'] = 'gray'
plt.rcParams['image.interpolation'] = None
note_pt = dict()
# Sharps
note_pt['A4'] = 440.0
for octave in range(0, 10):
note_pt['A{}'.format(octave)] = 440.0*2**(octave-4)
note_pt['E1'] = 1.5*note_pt['A0']
for octave in range(0, 10):
note_pt['E{}'.format(octave)] = note_pt['E1']*2**(octave-1)
note_pt['B0'] = 1.5*note_pt['E0']
for octave in range(0, 10):
note_pt['B{}'.format(octave)] = note_pt['B0']*2**(octave-0)
note_pt['F#1'] = 1.5*note_pt['B0']
for octave in range(0, 10):
note_pt['F#{}'.format(octave)] = note_pt['F#1']*2**(octave-1)
note_pt['C#1'] = 1.5*note_pt['F#0']
for octave in range(0, 10):
note_pt['C#{}'.format(octave)] = note_pt['C#1']*2**(octave-1)
note_pt['G#0'] = 1.5*note_pt['C#0']
for octave in range(0, 10):
note_pt['G#{}'.format(octave)] = note_pt['G#0']*2**(octave-0)
note_pt['D#1'] = 1.5*note_pt['G#0']
for octave in range(0, 10):
note_pt['D#{}'.format(octave)] = note_pt['D#1']*2**(octave-1)
note_pt['A#0'] = 1.5*note_pt['D#0']
for octave in range(0, 10):
note_pt['A#{}'.format(octave)] = note_pt['A#0']*2**(octave-0)
note_pt['E#1'] = 1.5*note_pt['A#0']
for octave in range(0, 10):
note_pt['E#{}'.format(octave)] = note_pt['E#1']*2**(octave-1)
note_pt['B#0'] = 1.5*note_pt['E#0']
for octave in range(0, 10):
note_pt['B#{}'.format(octave)] = note_pt['B#0']*2**(octave-0)
# Flats
note_pt['D0'] = 2/3*note_pt['A0']
for octave in range(0, 10):
note_pt['D{}'.format(octave)] = note_pt['D0']*2**octave
note_pt['G0'] = 2/3*note_pt['D1']
for octave in range(0, 10):
note_pt['G{}'.format(octave)] = note_pt['G0']*2**octave
note_pt['C0'] = 2/3*note_pt['G0']
for octave in range(0, 10):
note_pt['C{}'.format(octave)] = note_pt['C0']*2**octave
note_pt['F0'] = 2/3*note_pt['C1']
for octave in range(0, 10):
note_pt['F{}'.format(octave)] = note_pt['F0']*2**octave
note_pt['Bb0'] = 2/3*note_pt['F1']
for octave in range(0, 10):
note_pt['Bb{}'.format(octave)] = note_pt['Bb0']*2**octave
note_pt['Eb0'] = 2/3*note_pt['Bb0']
for octave in range(0, 10):
note_pt['Eb{}'.format(octave)] = note_pt['Eb0']*2**octave
note_pt['Ab0'] = 2/3*note_pt['Eb1']
for octave in range(0, 10):
note_pt['Ab{}'.format(octave)] = note_pt['Ab0']*2**octave
note_pt['Db0'] = 2/3*note_pt['Ab0']
for octave in range(0, 10):
note_pt['Db{}'.format(octave)] = note_pt['Db0']*2**octave
note_pt['Gb0'] = 2/3*note_pt['Db1']
for octave in range(0, 10):
note_pt['Gb{}'.format(octave)] = note_pt['Gb0']*2**octave
note_pt['Cb0'] = 2/3*note_pt['Gb0']
for octave in range(0, 10):
note_pt['Cb{}'.format(octave)] = note_pt['Cb0']*2**octave
note_pt['Fb0'] = 2/3*note_pt['Cb1']
for octave in range(0, 10):
note_pt['Fb{}'.format(octave)] = note_pt['Fb0']*2**octave
sorted_notes = sorted(note_pt.items(), key=lambda x:x[1])
markdown = """|note|midi-ET|Hertz-ET|midi-PT|Hertz-PT|\n"""
markdown += """|----|----|-----|----|----|-----|\n"""
for note, f_pt in sorted_notes:
midi_et = librosa.note_to_midi(note)
f_et = librosa.midi_to_hz(midi_et)
midi_pt = librosa.hz_to_midi(f_pt)
if note.startswith('A') and midi_et % 12 == 9:
ipd.display_markdown(markdown, raw=True)
markdown = """|note|midi-ET|Hertz-ET|midi-PT|Hertz-PT|\n"""
markdown += """|----|----|-----|----|----|-----|\n"""
markdown += """|{}|{}|{:.5g}|{:.3f}|{:.5g}|\n""".format(
note, midi_et, f_et, midi_pt, f_pt
)
ipd.display_markdown(markdown, raw=True)
note | midi-ET | Hertz-ET | midi-PT | Hertz-PT | |
---|---|---|---|---|---|
Cb0 | 11 | 15.434 | 10.804 | 15.261 | |
C0 | 12 | 16.352 | 11.941 | 16.296 | |
Db0 | 13 | 17.324 | 12.844 | 17.168 | |
C#0 | 13 | 17.324 | 13.078 | 17.402 | |
D0 | 14 | 18.354 | 13.980 | 18.333 | |
Eb0 | 15 | 19.445 | 14.883 | 19.314 | |
D#0 | 15 | 19.445 | 15.117 | 19.578 | |
Fb0 | 16 | 20.602 | 15.785 | 20.347 | |
E0 | 16 | 20.602 | 16.020 | 20.625 | |
F0 | 17 | 21.827 | 16.922 | 21.728 | |
E#0 | 17 | 21.827 | 17.156 | 22.025 | |
Gb0 | 18 | 23.125 | 17.824 | 22.891 | |
F#0 | 18 | 23.125 | 18.059 | 23.203 | |
G0 | 19 | 24.5 | 18.961 | 24.444 | |
Ab0 | 20 | 25.957 | 19.863 | 25.752 | |
G#0 | 20 | 25.957 | 20.098 | 26.104 |
note | midi-ET | Hertz-ET | midi-PT | Hertz-PT | |
---|---|---|---|---|---|
A0 | 21 | 27.5 | 21.000 | 27.5 | |
Bb0 | 22 | 29.135 | 21.902 | 28.971 | |
A#0 | 22 | 29.135 | 22.137 | 29.366 | |
Cb1 | 23 | 30.868 | 22.804 | 30.521 | |
B0 | 23 | 30.868 | 23.039 | 30.938 | |
C1 | 24 | 32.703 | 23.941 | 32.593 | |
B#0 | 24 | 32.703 | 24.176 | 33.037 | |
Db1 | 25 | 34.648 | 24.844 | 34.336 | |
C#1 | 25 | 34.648 | 25.078 | 34.805 | |
D1 | 26 | 36.708 | 25.980 | 36.667 | |
Eb1 | 27 | 38.891 | 26.883 | 38.628 | |
D#1 | 27 | 38.891 | 27.117 | 39.155 | |
Fb1 | 28 | 41.203 | 27.785 | 40.695 | |
E1 | 28 | 41.203 | 28.020 | 41.25 | |
F1 | 29 | 43.654 | 28.922 | 43.457 | |
E#1 | 29 | 43.654 | 29.156 | 44.05 | |
Gb1 | 30 | 46.249 | 29.824 | 45.782 | |
F#1 | 30 | 46.249 | 30.059 | 46.406 | |
G1 | 31 | 48.999 | 30.961 | 48.889 | |
Ab1 | 32 | 51.913 | 31.863 | 51.504 | |
G#1 | 32 | 51.913 | 32.098 | 52.207 |
note | midi-ET | Hertz-ET | midi-PT | Hertz-PT | |
---|---|---|---|---|---|
A1 | 33 | 55 | 33.000 | 55 | |
Bb1 | 34 | 58.27 | 33.902 | 57.942 | |
A#1 | 34 | 58.27 | 34.137 | 58.733 | |
Cb2 | 35 | 61.735 | 34.804 | 61.042 | |
B1 | 35 | 61.735 | 35.039 | 61.875 | |
C2 | 36 | 65.406 | 35.941 | 65.185 | |
B#1 | 36 | 65.406 | 36.176 | 66.075 | |
Db2 | 37 | 69.296 | 36.844 | 68.672 | |
C#2 | 37 | 69.296 | 37.078 | 69.609 | |
D2 | 38 | 73.416 | 37.980 | 73.333 | |
Eb2 | 39 | 77.782 | 38.883 | 77.257 | |
D#2 | 39 | 77.782 | 39.117 | 78.311 | |
Fb2 | 40 | 82.407 | 39.785 | 81.39 | |
E2 | 40 | 82.407 | 40.020 | 82.5 | |
F2 | 41 | 87.307 | 40.922 | 86.914 | |
E#2 | 41 | 87.307 | 41.156 | 88.099 | |
Gb2 | 42 | 92.499 | 41.824 | 91.563 | |
F#2 | 42 | 92.499 | 42.059 | 92.812 | |
G2 | 43 | 97.999 | 42.961 | 97.778 | |
Ab2 | 44 | 103.83 | 43.863 | 103.01 | |
G#2 | 44 | 103.83 | 44.098 | 104.41 |
note | midi-ET | Hertz-ET | midi-PT | Hertz-PT | |
---|---|---|---|---|---|
A2 | 45 | 110 | 45.000 | 110 | |
Bb2 | 46 | 116.54 | 45.902 | 115.88 | |
A#2 | 46 | 116.54 | 46.137 | 117.47 | |
Cb3 | 47 | 123.47 | 46.804 | 122.08 | |
B2 | 47 | 123.47 | 47.039 | 123.75 | |
C3 | 48 | 130.81 | 47.941 | 130.37 | |
B#2 | 48 | 130.81 | 48.176 | 132.15 | |
Db3 | 49 | 138.59 | 48.844 | 137.34 | |
C#3 | 49 | 138.59 | 49.078 | 139.22 | |
D3 | 50 | 146.83 | 49.980 | 146.67 | |
Eb3 | 51 | 155.56 | 50.883 | 154.51 | |
D#3 | 51 | 155.56 | 51.117 | 156.62 | |
Fb3 | 52 | 164.81 | 51.785 | 162.78 | |
E3 | 52 | 164.81 | 52.020 | 165 | |
F3 | 53 | 174.61 | 52.922 | 173.83 | |
E#3 | 53 | 174.61 | 53.156 | 176.2 | |
Gb3 | 54 | 185 | 53.824 | 183.13 | |
F#3 | 54 | 185 | 54.059 | 185.62 | |
G3 | 55 | 196 | 54.961 | 195.56 | |
Ab3 | 56 | 207.65 | 55.863 | 206.02 | |
G#3 | 56 | 207.65 | 56.098 | 208.83 |
note | midi-ET | Hertz-ET | midi-PT | Hertz-PT | |
---|---|---|---|---|---|
A3 | 57 | 220 | 57.000 | 220 | |
Bb3 | 58 | 233.08 | 57.902 | 231.77 | |
A#3 | 58 | 233.08 | 58.137 | 234.93 | |
Cb4 | 59 | 246.94 | 58.804 | 244.17 | |
B3 | 59 | 246.94 | 59.039 | 247.5 | |
C4 | 60 | 261.63 | 59.941 | 260.74 | |
B#3 | 60 | 261.63 | 60.176 | 264.3 | |
Db4 | 61 | 277.18 | 60.844 | 274.69 | |
C#4 | 61 | 277.18 | 61.078 | 278.44 | |
D4 | 62 | 293.66 | 61.980 | 293.33 | |
Eb4 | 63 | 311.13 | 62.883 | 309.03 | |
D#4 | 63 | 311.13 | 63.117 | 313.24 | |
Fb4 | 64 | 329.63 | 63.785 | 325.56 | |
E4 | 64 | 329.63 | 64.020 | 330 | |
F4 | 65 | 349.23 | 64.922 | 347.65 | |
E#4 | 65 | 349.23 | 65.156 | 352.4 | |
Gb4 | 66 | 369.99 | 65.824 | 366.25 | |
F#4 | 66 | 369.99 | 66.059 | 371.25 | |
G4 | 67 | 392 | 66.961 | 391.11 | |
Ab4 | 68 | 415.3 | 67.863 | 412.03 | |
G#4 | 68 | 415.3 | 68.098 | 417.66 |
note | midi-ET | Hertz-ET | midi-PT | Hertz-PT | |
---|---|---|---|---|---|
A4 | 69 | 440 | 69.000 | 440 | |
Bb4 | 70 | 466.16 | 69.902 | 463.54 | |
A#4 | 70 | 466.16 | 70.137 | 469.86 | |
Cb5 | 71 | 493.88 | 70.804 | 488.34 | |
B4 | 71 | 493.88 | 71.039 | 495 | |
C5 | 72 | 523.25 | 71.941 | 521.48 | |
B#4 | 72 | 523.25 | 72.176 | 528.6 | |
Db5 | 73 | 554.37 | 72.844 | 549.38 | |
C#5 | 73 | 554.37 | 73.078 | 556.88 | |
D5 | 74 | 587.33 | 73.980 | 586.67 | |
Eb5 | 75 | 622.25 | 74.883 | 618.05 | |
D#5 | 75 | 622.25 | 75.117 | 626.48 | |
Fb5 | 76 | 659.26 | 75.785 | 651.12 | |
E5 | 76 | 659.26 | 76.020 | 660 | |
F5 | 77 | 698.46 | 76.922 | 695.31 | |
E#5 | 77 | 698.46 | 77.156 | 704.79 | |
Gb5 | 78 | 739.99 | 77.824 | 732.51 | |
F#5 | 78 | 739.99 | 78.059 | 742.5 | |
G5 | 79 | 783.99 | 78.961 | 782.22 | |
Ab5 | 80 | 830.61 | 79.863 | 824.07 | |
G#5 | 80 | 830.61 | 80.098 | 835.31 |
note | midi-ET | Hertz-ET | midi-PT | Hertz-PT | |
---|---|---|---|---|---|
A5 | 81 | 880 | 81.000 | 880 | |
Bb5 | 82 | 932.33 | 81.902 | 927.08 | |
A#5 | 82 | 932.33 | 82.137 | 939.73 | |
Cb6 | 83 | 987.77 | 82.804 | 976.67 | |
B5 | 83 | 987.77 | 83.039 | 990 | |
C6 | 84 | 1046.5 | 83.941 | 1043 | |
B#5 | 84 | 1046.5 | 84.176 | 1057.2 | |
Db6 | 85 | 1108.7 | 84.844 | 1098.8 | |
C#6 | 85 | 1108.7 | 85.078 | 1113.8 | |
D6 | 86 | 1174.7 | 85.980 | 1173.3 | |
Eb6 | 87 | 1244.5 | 86.883 | 1236.1 | |
D#6 | 87 | 1244.5 | 87.117 | 1253 | |
Fb6 | 88 | 1318.5 | 87.785 | 1302.2 | |
E6 | 88 | 1318.5 | 88.020 | 1320 | |
F6 | 89 | 1396.9 | 88.922 | 1390.6 | |
E#6 | 89 | 1396.9 | 89.156 | 1409.6 | |
Gb6 | 90 | 1480 | 89.824 | 1465 | |
F#6 | 90 | 1480 | 90.059 | 1485 | |
G6 | 91 | 1568 | 90.961 | 1564.4 | |
Ab6 | 92 | 1661.2 | 91.863 | 1648.1 | |
G#6 | 92 | 1661.2 | 92.098 | 1670.6 |
note | midi-ET | Hertz-ET | midi-PT | Hertz-PT | |
---|---|---|---|---|---|
A6 | 93 | 1760 | 93.000 | 1760 | |
Bb6 | 94 | 1864.7 | 93.902 | 1854.2 | |
A#6 | 94 | 1864.7 | 94.137 | 1879.5 | |
Cb7 | 95 | 1975.5 | 94.804 | 1953.3 | |
B6 | 95 | 1975.5 | 95.039 | 1980 | |
C7 | 96 | 2093 | 95.941 | 2085.9 | |
B#6 | 96 | 2093 | 96.176 | 2114.4 | |
Db7 | 97 | 2217.5 | 96.844 | 2197.5 | |
C#7 | 97 | 2217.5 | 97.078 | 2227.5 | |
D7 | 98 | 2349.3 | 97.980 | 2346.7 | |
Eb7 | 99 | 2489 | 98.883 | 2472.2 | |
D#7 | 99 | 2489 | 99.117 | 2505.9 | |
Fb7 | 100 | 2637 | 99.785 | 2604.5 | |
E7 | 100 | 2637 | 100.020 | 2640 | |
F7 | 101 | 2793.8 | 100.922 | 2781.2 | |
E#7 | 101 | 2793.8 | 101.156 | 2819.2 | |
Gb7 | 102 | 2960 | 101.824 | 2930 | |
F#7 | 102 | 2960 | 102.059 | 2970 | |
G7 | 103 | 3136 | 102.961 | 3128.9 | |
Ab7 | 104 | 3322.4 | 103.863 | 3296.3 | |
G#7 | 104 | 3322.4 | 104.098 | 3341.2 |
note | midi-ET | Hertz-ET | midi-PT | Hertz-PT | |
---|---|---|---|---|---|
A7 | 105 | 3520 | 105.000 | 3520 | |
Bb7 | 106 | 3729.3 | 105.902 | 3708.3 | |
A#7 | 106 | 3729.3 | 106.137 | 3758.9 | |
Cb8 | 107 | 3951.1 | 106.804 | 3906.7 | |
B7 | 107 | 3951.1 | 107.039 | 3960 | |
C8 | 108 | 4186 | 107.941 | 4171.9 | |
B#7 | 108 | 4186 | 108.176 | 4228.8 | |
Db8 | 109 | 4434.9 | 108.844 | 4395 | |
C#8 | 109 | 4434.9 | 109.078 | 4455 | |
D8 | 110 | 4698.6 | 109.980 | 4693.3 | |
Eb8 | 111 | 4978 | 110.883 | 4944.4 | |
D#8 | 111 | 4978 | 111.117 | 5011.9 | |
Fb8 | 112 | 5274 | 111.785 | 5208.9 | |
E8 | 112 | 5274 | 112.020 | 5280 | |
F8 | 113 | 5587.7 | 112.922 | 5562.5 | |
E#8 | 113 | 5587.7 | 113.156 | 5638.4 | |
Gb8 | 114 | 5919.9 | 113.824 | 5860 | |
F#8 | 114 | 5919.9 | 114.059 | 5940 | |
G8 | 115 | 6271.9 | 114.961 | 6257.8 | |
Ab8 | 116 | 6644.9 | 115.863 | 6592.6 | |
G#8 | 116 | 6644.9 | 116.098 | 6682.5 |
note | midi-ET | Hertz-ET | midi-PT | Hertz-PT | |
---|---|---|---|---|---|
A8 | 117 | 7040 | 117.000 | 7040 | |
Bb8 | 118 | 7458.6 | 117.902 | 7416.6 | |
A#8 | 118 | 7458.6 | 118.137 | 7517.8 | |
Cb9 | 119 | 7902.1 | 118.804 | 7813.4 | |
B8 | 119 | 7902.1 | 119.039 | 7920 | |
C9 | 120 | 8372 | 119.941 | 8343.7 | |
B#8 | 120 | 8372 | 120.176 | 8457.5 | |
Db9 | 121 | 8869.8 | 120.844 | 8790.1 | |
C#9 | 121 | 8869.8 | 121.078 | 8910 | |
D9 | 122 | 9397.3 | 121.980 | 9386.7 | |
Eb9 | 123 | 9956.1 | 122.883 | 9888.8 | |
D#9 | 123 | 9956.1 | 123.117 | 10024 | |
Fb9 | 124 | 10548 | 123.785 | 10418 | |
E9 | 124 | 10548 | 124.020 | 10560 | |
F9 | 125 | 11175 | 124.922 | 11125 | |
E#9 | 125 | 11175 | 125.156 | 11277 | |
Gb9 | 126 | 11840 | 125.824 | 11720 | |
F#9 | 126 | 11840 | 126.059 | 11880 | |
G9 | 127 | 12544 | 126.961 | 12516 | |
Ab9 | 128 | 13290 | 127.863 | 13185 | |
G#9 | 128 | 13290 | 128.098 | 13365 |
note | midi-ET | Hertz-ET | midi-PT | Hertz-PT | |
---|---|---|---|---|---|
A9 | 129 | 14080 | 129.000 | 14080 | |
Bb9 | 130 | 14917 | 129.902 | 14833 | |
A#9 | 130 | 14917 | 130.137 | 15036 | |
B9 | 131 | 15804 | 131.039 | 15840 | |
B#9 | 132 | 16744 | 132.176 | 16915 |