Skip to content

Commit

Permalink
add wav2sketch.c by paul
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed Mar 18, 2021
1 parent 259d600 commit 546a2df
Show file tree
Hide file tree
Showing 5 changed files with 509 additions and 108 deletions.
1 change: 1 addition & 0 deletions bleepbloopmachine/.gitignore
@@ -1 +1,2 @@
build/
./wav2sketch
Binary file added bleepbloopmachine/wav2sketch
Binary file not shown.
Binary file modified code/lib/__pycache__/freq.cpython-39.pyc
Binary file not shown.
235 changes: 127 additions & 108 deletions code/lib/freq.py
@@ -1,110 +1,129 @@

freq = {
'b8': 7902.133,
'a#8': 7458.620,
'a8': 7040.000,
'g#8': 6644.875,
'g8': 6271.927,
'f#8': 5919.911,
'f8': 5587.652,
'e8': 5274.041,
'd#8': 4978.032,
'd8': 4698.636,
'c#8': 4434.922,
'c8': 4186.009,
'b7': 3951.066,
'a#7': 3729.310,
'a7': 3520.000,
'g#7': 3322.438,
'g7': 3135.963,
'f#7': 2959.955,
'f7': 2793.826,
'e7': 2637.020,
'd#7': 2489.016,
'd7': 2349.318,
'c#7': 2217.461,
'c7': 2093.005,
'b6': 1975.533,
'a#6': 1864.655,
'a6': 1760.000,
'g#6': 1661.219,
'g6': 1567.982,
'f#6': 1479.978,
'f6': 1396.913,
'e6': 1318.510,
'd#6': 1244.508,
'd6': 1174.659,
'c#6': 1108.731,
'c6': 1046.502,
'b5': 987.7666,
'a#5': 932.3275,
'a5': 880.0000,
'g#5': 830.6094,
'g5': 783.9909,
'f#5': 739.9888,
'f5': 698.4565,
'e5': 659.2551,
'd#5': 622.2540,
'd5': 587.3295,
'c#5': 554.3653,
'c5': 523.2511,
'b4': 493.8833,
'a#4': 466.1638,
'a4': 440.0000,
'g#4': 415.3047,
'g4': 391.9954,
'f#4': 369.9944,
'f4': 349.2282,
'e4': 329.6276,
'd#4': 311.1270,
'd4': 293.6648,
'c#4': 277.1826,
'c4': 261.6256,
'b3': 246.9417,
'a#3': 233.0819,
'a3': 220.0000,
'g#3': 207.6523,
'g3': 195.9977,
'f#3': 184.9972,
'f3': 174.6141,
'e3': 164.8138,
'd#3': 155.5635,
'd3': 146.8324,
'c#3': 138.5913,
'c3': 130.8128,
'b2': 123.4708,
'a#2': 116.5409,
'a2': 110.0000,
'g#2': 103.8262,
'g2': 97.99886,
'f#2': 92.49861,
'f2': 87.30706,
'e2': 82.40689,
'd#2': 77.78175,
'd2': 73.41619,
'c#2': 69.29566,
'c2': 65.40639,
'b1': 61.73541,
'a#1': 58.27047,
'a1': 55.00000,
'g#1': 51.91309,
'g1': 48.99943,
'f#1': 46.24930,
'f1': 43.65353,
'e1': 41.20344,
'd#1': 38.89087,
'd1': 36.70810,
'c#1': 34.64783,
'c1': 32.70320,
'b0': 30.86771,
'a#0': 29.13524,
'a0': 27.50000,
'g#0': 25.95654,
'g0': 24.49971,
'f#0': 23.12465,
'f0': 21.82676,
'e0': 20.60172,
'd#0': 19.44544,
'd0': 18.35405,
'c#0': 17.32391,
'c0': 16.35160,
'b8': 7902.133,
'a#8': 7458.620,
'a8': 7040.000,
'g#8': 6644.875,
'g8': 6271.927,
'f#8': 5919.911,
'f8': 5587.652,
'e8': 5274.041,
'd#8': 4978.032,
'd8': 4698.636,
'c#8': 4434.922,
'c8': 4186.009,
'b7': 3951.066,
'a#7': 3729.310,
'a7': 3520.000,
'g#7': 3322.438,
'g7': 3135.963,
'f#7': 2959.955,
'f7': 2793.826,
'e7': 2637.020,
'd#7': 2489.016,
'd7': 2349.318,
'c#7': 2217.461,
'c7': 2093.005,
'b6': 1975.533,
'a#6': 1864.655,
'a6': 1760.000,
'g#6': 1661.219,
'g6': 1567.982,
'f#6': 1479.978,
'f6': 1396.913,
'e6': 1318.510,
'd#6': 1244.508,
'd6': 1174.659,
'c#6': 1108.731,
'c6': 1046.502,
'b5': 987.7666,
'a#5': 932.3275,
'a5': 880.0000,
'g#5': 830.6094,
'g5': 783.9909,
'f#5': 739.9888,
'f5': 698.4565,
'e5': 659.2551,
'd#5': 622.2540,
'd5': 587.3295,
'c#5': 554.3653,
'c5': 523.2511,
'b4': 493.8833,
'a#4': 466.1638,
'a4': 440.0000,
'g#4': 415.3047,
'g4': 391.9954,
'f#4': 369.9944,
'f4': 349.2282,
'e4': 329.6276,
'd#4': 311.1270,
'd4': 293.6648,
'c#4': 277.1826,
'c4': 261.6256,
'b3': 246.9417,
'a#3': 233.0819,
'a3': 220.0000,
'g#3': 207.6523,
'g3': 195.9977,
'f#3': 184.9972,
'f3': 174.6141,
'e3': 164.8138,
'd#3': 155.5635,
'd3': 146.8324,
'c#3': 138.5913,
'c3': 130.8128,
'b2': 123.4708,
'a#2': 116.5409,
'a2': 110.0000,
'g#2': 103.8262,
'g2': 97.99886,
'f#2': 92.49861,
'f2': 87.30706,
'e2': 82.40689,
'd#2': 77.78175,
'd2': 73.41619,
'c#2': 69.29566,
'c2': 65.40639,
'b1': 61.73541,
'a#1': 58.27047,
'a1': 55.00000,
'g#1': 51.91309,
'g1': 48.99943,
'f#1': 46.24930,
'f1': 43.65353,
'e1': 41.20344,
'd#1': 38.89087,
'd1': 36.70810,
'c#1': 34.64783,
'c1': 32.70320,
'b0': 30.86771,
'a#0': 29.13524,
'a0': 27.50000,
'g#0': 25.95654,
'g0': 24.49971,
'f#0': 23.12465,
'f0': 21.82676,
'e0': 20.60172,
'd#0': 19.44544,
'd0': 18.35405,
'c#0': 17.32391,
'c0': 16.35160,
}

cf = [[], [], [], [], [], [], [], [], [], [], [], []]

notes = ["c", "c#", "d", "d#", "e", "f", "f#", "g", "g#", "a", "a#", "b"]

for k, v in freq.items():
note_name = k[0:-1]
octave = int(k[-1])
cf[notes.index(note_name)].insert(0, v)

print("auto freq = {")
for note in cf:
print("{", end="")
for octave in note:
print(octave, end=", ")
print("}", end=",")

print("};")

0 comments on commit 546a2df

Please sign in to comment.