File: drumseq_randomize.py

package info (click to toggle)
bespokesynth 1.3.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 44,592 kB
  • sloc: cpp: 117,136; ansic: 18,752; python: 593; xml: 74; makefile: 4
file content (21 lines) | stat: -rw-r--r-- 503 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#requires a drumsequencer named "drumsequencer"

import drumsequencer

d = drumsequencer.get("drumsequencer")

def randomVel():
   return random.choice([0,0,random.randint(1,127)])   

for row in range(8):
   for step in range(16):
      d.set(step, row, randomVel()) 
   for step in range(16):
      vel = d.get(step, row)
      if random.random() < .25:
         vel = randomVel()
      d.set(step+16, row, vel)

for step in range(32):
   if step % 4 == 0:
      d.set(step, random.choice([0,4]), 127)