Debian Codegraph @

src/Scripts/LiveCoding/loopology.py

raw symbols SCIP
1 """
2 loopology.py RWD 09-20121
3 By Richard Dobson and Andres Cabrera
4 A mini musical automaton.
5 The heart of this "composition" is a 5-line loop
6 excluding the line which actually writes the note.
7 """
8 from time import sleep
9
10 q.loadDocument("loopology.csd")
11 q.play()
12 sleep(0.3)
13 q.loadDocument("loopology.py")
14
15
16 time = 0.0
17 duration = 0.2
18 tempo = 110.0
19 velocity = 100
20
21 pitch = 48
22 interval = 5
23 range = 23
24 enddur = 60
25 note = 0
26
27 sco = ''
28 while time < enddur :
29 sco +="i 1 %f %f %f %f\n"%(time *60/tempo,duration,pitch + note, velocity)
30 note += interval
31 note %= range
32 time += duration
33 tempo += 0.025
34 if ((int(time * 5) % 20)) == 0 :
35 interval += 1
36 q.refresh()
37
38 q.sendEvent(sco)
39 print("done.")