-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsection.py
More file actions
30 lines (25 loc) · 715 Bytes
/
section.py
File metadata and controls
30 lines (25 loc) · 715 Bytes
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
import performer
import watchman
import random
import tools
import bass
import chords
import melody
rhythm = [".",".",".",".",".",".",".",".",".",".",".",".",".",".",".","."]
xlim = 6
def note_no():
chosen = tools.weighted_choice(tools.rhythm_choices)
return int(chosen)
def gen_rhythm():
global rhythm
tem = [".",".",".",".",".",".",".",".",".",".",".",".",".",".",".","."]
for i in xrange(int(performer.tsig * performer.timing)):
if random.random() < float(watchman.activities["section"]):
if tem.count("x") <= xlim:
tem[note_no()] = "x"
bass.rhythm = tem
chords.rhythm = tem
melody.rhythm = tem
rhythm = tem
def gen():
gen_rhythm()