""" 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))