diff --git a/generate.py b/generate.py index f43f85e..3047629 100644 --- a/generate.py +++ b/generate.py @@ -16,13 +16,7 @@ def sine(dur, freq, value=1): signal=soundbox.sine(dur, freq, value)) -def square(dur, freq, value=1): - return soundbox.envelope( - attack=.2, decay=.2, release=.2, - signal=soundbox.square(dur, freq, value)) - - -signal = soundbox.silence(9) +signal = soundbox.silence(10) chords_l = ( (('do', 2),), @@ -46,9 +40,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=.4, + instr=sine, dur=.8 if shift == 4.5 and i == 7 else .4, freqs=soundbox.note_freqs(chords_l[i]), - value=.04 + value=.4 )) for i in range(len(chords_r)): @@ -56,7 +50,7 @@ for shift in (.5, 4.5): source=soundbox.chord( instr=sine, dur=1.1, freqs=soundbox.note_freqs(chords_r[i]), - value=.5 + value=.4 )) soundbox.save_signal(output_file, signal) diff --git a/soundbox.py b/soundbox.py index a55f624..b3a04ce 100644 --- a/soundbox.py +++ b/soundbox.py @@ -1,6 +1,5 @@ import wave import numpy as np -import scipy.signal as sig import math # Nombre d’octets par échantillon @@ -26,11 +25,6 @@ def sine(dur, freq, value=1): return value * max_val * np.sin(2 * np.pi * freq * x / samp_rate) -def square(dur, freq, value=1): - x = np.arange(int(samp_rate * dur)) - return value * max_val * sig.square(2 * np.pi * freq * x / samp_rate) - - def envelope(attack, decay, release, signal): total = len(signal) attack = int(attack * total) diff --git a/sounds/synth.wav b/sounds/synth.wav index aa3449e..e03bd48 100644 Binary files a/sounds/synth.wav and b/sounds/synth.wav differ