-
Notifications
You must be signed in to change notification settings - Fork 0
/
score.py
53 lines (37 loc) · 1.3 KB
/
score.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
50
51
52
53
""" pip install pippi """
from pippi import dsp
def make_cycles(length):
""" Well begun, half done """
num_harmonics = dsp.randint(1, 6)
val_harmonics = [1, 2, 3, dsp.randint(4, 7), dsp.randint(5, 9)]
# Each collection of partials
min_length = dsp.stf(10)
max_length = dsp.stf(18)
root = 40.0 # hz
# Deviate
root = root + dsp.rand()
elapsed = 0
cycles = []
# Count off
while elapsed < length:
cycle_length = dsp.randint(min_length, max_length)
harmonics = [
dsp.tone(
length=cycle_length,
freq=root * dsp.randchoose(val_harmonics),
amp=dsp.rand(0.1, 0.4),
wavetype='impulse'
)
for h in range(num_harmonics) ]
harmonics = [ dsp.pan(harmonic, dsp.rand()) for harmonic in harmonics ]
harmonics = [ dsp.env(harmonic, 'gauss') for harmonic in harmonics ]
cycles += [ dsp.mix(harmonics) ]
elapsed += cycle_length
return ''.join(cycles)
cycles = [ make_cycles(dsp.stf(60 * 2)) for i in range(4) ]
out = dsp.mix(cycles)
out = dsp.pine(out, dsp.stf(60 * 8), 80.0 * 2)
cycles = [ make_cycles(dsp.stf(60 * 8)) for i in range(4) ]
cycles = dsp.mix(cycles)
out = dsp.mix([ out, cycles ])
dsp.write(out, 'newly')