Browse Source

Audio

pull/10/head
Jure Šorn 5 years ago
parent
commit
217cf97edf
1 changed files with 1 additions and 1 deletions
  1. 2
      README.md

2
README.md

@ -1576,9 +1576,9 @@ from itertools import chain, repeat
F = 44100
S1 = '59♪,57,,59♪,54,,50♪,54,,47♪,,,'
S2 = '59♪,61,,62♪,61,,62,,59,,61♪,59,,61,,57,,59♪,57,,59,,55,,59♪,,,'
get_pause = lambda seconds: repeat(0, int(seconds * F))
sin_f = lambda i, hz: math.sin(i * 2 * math.pi * hz / F)
get_wave = lambda hz, seconds: (sin_f(i, hz) for i in range(int(seconds * F)))
get_pause = lambda seconds: repeat(0, int(seconds * F))
get_hz = lambda note: round(16.352 * 2 ** (int(note[:2]) / 12))
parse_n = lambda note: (get_hz(note), 0.25 if len(note) > 2 else 0.125)
get_note = lambda note: get_wave(*parse_n(note)) if note else get_pause(0.125)

Loading…
Cancel
Save