forked from ideoforms/isobar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path07.ex-static-pattern.py
More file actions
executable file
·42 lines (38 loc) · 1.14 KB
/
07.ex-static-pattern.py
File metadata and controls
executable file
·42 lines (38 loc) · 1.14 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
38
39
40
41
42
#!/usr/bin/env python3
#------------------------------------------------------------------------
# isobar: ex-static-pattern
#
# Bind a chord sequence to a static sequence, which is then referenced
# in other patterns.
#------------------------------------------------------------------------
from isobar.key import Key
from isobar.pattern.static import PStaticPattern
from isobar.pattern.sequence import PSequence
from isobar.pattern.chance import PWhite
from isobar.pattern.sequence import PCreep
from isobar.timelines.timeline import Timeline
import logging
def main():
key_sequence = PSequence([
Key("C", "minor"),
Key("G", "minor"),
Key("Bb", "major"),
Key("F", "major"),
])
key = PStaticPattern(key_sequence, 4)
timeline = Timeline(120)
timeline.schedule({
"degree": 0,
"key": key,
"octave": 3
})
timeline.schedule({
"degree": PCreep(PWhite(0, 6), 4, 4, 4),
"key": key,
"octave": 6,
"duration": 0.25
})
timeline.run()
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO, format="[%(asctime)s] %(message)s")
main()