-
Notifications
You must be signed in to change notification settings - Fork 0
/
sound_base06.py
49 lines (29 loc) · 1.02 KB
/
sound_base06.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import numpy as np
from wave_file import wave_write_16bit_mono
from sound_color import sawtooth_out
from biquad_filter import LPF
from biquad_filter import filter
from sound_touch_ADSR import set_touch_SOFT
from sound_touch_ADSR import touch_ADSR
from sound_touch_ADSR import delay
sampling = 44100
sound_a = 440
octave = 0
fcut = 1000
quality = 1/np.sqrt(2)
duration = 100000
a,b = LPF(sampling,fcut,quality)
set_touch_SOFT
for i in range(0,13):
note = ( octave + 1 ) * 12 - 3 + ( i - 8)
pow = 1.0
length_of_s_master = int(duration)
s_master = np.zeros(length_of_s_master)
for dt in range(0,60) :
st = sawtooth_out(sound_a,duration,note + (dt % 20 - 10) /17 + np.random.rand()/3,pow,sampling)
sk = touch_ADSR(st)
sd = delay(sk,int(np.random.rand()*100))
sf = filter(a,b,sd)
s_master += sf
s_master /= np.max(np.abs(s_master))
wave_write_16bit_mono(sampling, s_master.copy(), 'snd' + str(i+1) + 'cor.wav')