forked from ideoforms/isobar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path06.ex-walk.py
More file actions
executable file
·37 lines (29 loc) · 1.11 KB
/
06.ex-walk.py
File metadata and controls
executable file
·37 lines (29 loc) · 1.11 KB
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
#!/usr/bin/env python3
#------------------------------------------------------------------------
# isobar: ex-walk
#
# Brownian walk around a scale.
#------------------------------------------------------------------------
import isobar as iso
import logging
logging.basicConfig(level=logging.INFO, format="[%(asctime)s] %(message)s")
#------------------------------------------------------------------------
# walk up and down a minor scale
#------------------------------------------------------------------------
scale = iso.Scale([0, 2, 3, 7, 9, 11])
degree = iso.PBrown(0, 2, -8, 16)
notes = iso.PDegree(degree, scale) + 60
#------------------------------------------------------------------------
# add a slight 4/4 emphasis and moderate variation in velocity
#------------------------------------------------------------------------
amp = iso.PSequence([40, 30, 20, 25]) + iso.PBrown(0, 2, -10, 10)
timeline = iso.Timeline(170)
timeline.schedule({
"note": notes,
"duration": 0.25,
"gate": 0.9,
"amplitude": amp})
try:
timeline.run()
except KeyboardInterrupt:
timeline.output_device.all_notes_off()