Réduit attaque onde carrée, paramétrise generate
This commit is contained in:
parent
de9d35b08b
commit
9e8e8db032
Binary file not shown.
Before Width: | Height: | Size: 162 KiB After Width: | Height: | Size: 143 KiB |
Binary file not shown.
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
19
generate.py
19
generate.py
|
@ -1,4 +1,13 @@
|
||||||
import soundbox
|
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):
|
def sine(dur, freq, value=1):
|
||||||
|
@ -9,7 +18,7 @@ def sine(dur, freq, value=1):
|
||||||
|
|
||||||
def square(dur, freq, value=1):
|
def square(dur, freq, value=1):
|
||||||
return soundbox.envelope(
|
return soundbox.envelope(
|
||||||
attack=.01, decay=.2, release=.2,
|
attack=.2, decay=.2, release=.2,
|
||||||
signal=soundbox.square(dur, freq, value))
|
signal=soundbox.square(dur, freq, value))
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,9 +46,9 @@ for shift in (.5, 4.5):
|
||||||
for i in range(len(chords_l)):
|
for i in range(len(chords_l)):
|
||||||
soundbox.add_signal(signal, start=i / 2 + shift,
|
soundbox.add_signal(signal, start=i / 2 + shift,
|
||||||
source=soundbox.chord(
|
source=soundbox.chord(
|
||||||
instr=square, dur=.6,
|
instr=square, dur=.4,
|
||||||
freqs=soundbox.note_freqs(chords_l[i]),
|
freqs=soundbox.note_freqs(chords_l[i]),
|
||||||
value=.05
|
value=.04
|
||||||
))
|
))
|
||||||
|
|
||||||
for i in range(len(chords_r)):
|
for i in range(len(chords_r)):
|
||||||
|
@ -47,7 +56,7 @@ for shift in (.5, 4.5):
|
||||||
source=soundbox.chord(
|
source=soundbox.chord(
|
||||||
instr=sine, dur=1.1,
|
instr=sine, dur=1.1,
|
||||||
freqs=soundbox.note_freqs(chords_r[i]),
|
freqs=soundbox.note_freqs(chords_r[i]),
|
||||||
value=.6
|
value=.5
|
||||||
))
|
))
|
||||||
|
|
||||||
soundbox.save_signal('out.wav', signal)
|
soundbox.save_signal(output_file, signal)
|
||||||
|
|
Binary file not shown.
BIN
sounds/synth.wav
BIN
sounds/synth.wav
Binary file not shown.
Loading…
Reference in New Issue