25 lines
377 B
Python
25 lines
377 B
Python
"""
|
|
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)
|