@@ -1624,15 +1624,15 @@ wf.close()
1624
1624
import simpleaudio, math, struct
1625
1625
from itertools import chain, repeat
1626
1626
F = 44100
1627
- S1 = ' 71♪,69,,71♪,66,,62♪,66,,59♪,,,'
1628
- S2 = ' 71♪,73,,74♪,73,,74,,71,,73♪,71,,73,,69,,71♪,69,,71,,67,,71♪,,,'
1627
+ P1 = ' 71♪,69,,71♪,66,,62♪,66,,59♪,,,'
1628
+ P2 = ' 71♪,73,,74♪,73,,74,,71,,73♪,71,,73,,69,,71♪,69,,71,,67,,71♪,,,'
1629
1629
get_pause = lambda seconds : repeat(0 , int (seconds * F))
1630
1630
sin_f = lambda i , hz : math.sin(i * 2 * math.pi * hz / F)
1631
1631
get_wave = lambda hz , seconds : (sin_f(i, hz) for i in range (int (seconds * F)))
1632
1632
get_hz = lambda n : 8.176 * 2 ** (int (n) / 12 )
1633
1633
parse_n = lambda note : (get_hz(note[:2 ]), 0.25 if len (note) > 2 else 0.125 )
1634
1634
get_note = lambda note : get_wave(* parse_n(note)) if note else get_pause(0.125 )
1635
- samples_f = chain.from_iterable(get_note(n) for n in f ' { S1 }{ S1 }{ S2 } ' .split(' ,' ))
1635
+ samples_f = chain.from_iterable(get_note(n) for n in f ' { P1 }{ P1 }{ P2 } ' .split(' ,' ))
1636
1636
samples_b = b ' ' .join(struct.pack(' <h' , int (a * 30000 )) for a in samples_f)
1637
1637
simpleaudio.play_buffer(samples_b, 1 , 2 , F)
1638
1638
```
0 commit comments