Initial commit
This commit is contained in:
commit
778fe31c38
35 changed files with 1849 additions and 0 deletions
25
stage/level3.py
Normal file
25
stage/level3.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
"""
|
||||
Niveau 3
|
||||
Jouer une mélodie
|
||||
"""
|
||||
|
||||
import synth
|
||||
import math
|
||||
|
||||
music = [
|
||||
[1, 4],
|
||||
[1, 3],
|
||||
[1, 4],
|
||||
[1, 3],
|
||||
[1, 4],
|
||||
[1, -1],
|
||||
[1, 2],
|
||||
[1, 0],
|
||||
[2, -3]
|
||||
]
|
||||
|
||||
encoder = synth.Encoder()
|
||||
for note in music:
|
||||
for t in range(note[0]*3000):
|
||||
encoder.write(math.sin(t/16000 * 440 * 2**(note[1]/12) * 2*math.pi))
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue