@@ -1574,13 +1574,13 @@ wf.close()
1574
1574
import simpleaudio, math, struct
1575
1575
from itertools import chain, repeat
1576
1576
F = 44100
1577
- S1 = ' 59J,57j,,59J,54j,,50J,54j,,47J ,,,'
1578
- S2 = ' 59J,61j,,62J,61j,,62j,,59j,,61J,59j,,61j,,57j,,59J,57j,,59j,,55j,,59J ,,,'
1577
+ S1 = ' 59♪,57,,59♪,54,,50♪,54,,47♪ ,,,'
1578
+ S2 = ' 59♪,61,,62♪,61,,62,,59,,61♪,59,,61,,57,,59♪,57,,59,,55,,59♪ ,,,'
1579
1579
sin_f = lambda i , hz : math.sin(i * 2 * math.pi * hz / F)
1580
1580
get_wave = lambda hz , seconds : (sin_f(i, hz) for i in range (int (seconds * F)))
1581
1581
get_pause = lambda seconds : repeat(0 , int (seconds * F))
1582
1582
get_hz = lambda note : round (16.352 * 2 ** (int (note[:2 ])/ 12 ))
1583
- parse_n = lambda note : (get_hz(note), 0.25 if note[ 2 ] == ' J ' else 0.125 )
1583
+ parse_n = lambda note : (get_hz(note), 0.25 if len ( note) > 2 else 0.125 )
1584
1584
get_note = lambda note : get_wave(* parse_n(note)) if note else get_pause(0.125 )
1585
1585
samples_f = chain.from_iterable(get_note(n) for n in f ' { S1}{ S1}{ S2} ' .split(' ,' ))
1586
1586
samples_b = b ' ' .join(struct.pack(' <h' , int (a * 30000 )) for a in samples_f)
0 commit comments