diff --git a/fig/synth-shorttime.png b/fig/synth-shorttime.png index ab13e05..ac809d7 100644 Binary files a/fig/synth-shorttime.png and b/fig/synth-shorttime.png differ diff --git a/fig/synth-single.png b/fig/synth-single.png index 1556544..e6b9279 100644 Binary files a/fig/synth-single.png and b/fig/synth-single.png differ diff --git a/generate.py b/generate.py index cdc79b2..f43f85e 100644 --- a/generate.py +++ b/generate.py @@ -1,4 +1,13 @@ import soundbox +import sys + +if len(sys.argv) != 2: + print(f"""Utilisation: {sys.argv[0]} [output] + +Génère un morceau au synthétiseur dans le fichier [output].""") + sys.exit(1) + +output_file = sys.argv[1] def sine(dur, freq, value=1): @@ -9,7 +18,7 @@ def sine(dur, freq, value=1): def square(dur, freq, value=1): return soundbox.envelope( - attack=.01, decay=.2, release=.2, + attack=.2, decay=.2, release=.2, signal=soundbox.square(dur, freq, value)) @@ -37,9 +46,9 @@ for shift in (.5, 4.5): for i in range(len(chords_l)): soundbox.add_signal(signal, start=i / 2 + shift, source=soundbox.chord( - instr=square, dur=.6, + instr=square, dur=.4, freqs=soundbox.note_freqs(chords_l[i]), - value=.05 + value=.04 )) for i in range(len(chords_r)): @@ -47,7 +56,7 @@ for shift in (.5, 4.5): source=soundbox.chord( instr=sine, dur=1.1, freqs=soundbox.note_freqs(chords_r[i]), - value=.6 + value=.5 )) -soundbox.save_signal('out.wav', signal) +soundbox.save_signal(output_file, signal) diff --git a/sounds/piano.wav b/sounds/piano.wav new file mode 100644 index 0000000..a37cce7 Binary files /dev/null and b/sounds/piano.wav differ diff --git a/sounds/synth.wav b/sounds/synth.wav index 7caf414..aa3449e 100644 Binary files a/sounds/synth.wav and b/sounds/synth.wav differ