Initial commit

This commit is contained in:
Pascal Engélibert 2025-02-27 00:41:31 +01:00
commit 778fe31c38
35 changed files with 1849 additions and 0 deletions

25
stage/level4.py Normal file
View file

@ -0,0 +1,25 @@
"""
Niveau 4
Jouer des accords
"""
import synth
import math
music = [
[2, [5, 9]],
[2, [4, 8]],
[1, [-12]],
[1, [0, 2, 4]],
[1, [-10]],
[1, [2, 4, 6]],
]
encoder = synth.Encoder()
for chord in music:
for t in range(chord[0]*4000):
total = 0
for note in chord[1]:
total = total + math.sin(t/16000 * 440 * 2**(note/12) * 2*math.pi)
encoder.write(total * 0.3)