Module pippi.rhythm
Some helpers for building and transforming onset lists
Variables
BELL
CLAVE
MIN_BEAT
REST_SYMBOLS
RUMBA
SON
TRESILLO
Functions
eu
def eu(
length,
numbeats,
offset=0,
reps=None,
reverse=False
)
A euclidian pattern generator
Length 6, numbeats 3
rhythm.eu(6, 3) [1, 0, 1, 0, 1, 0]
Length 6, numbeats 3, offset 1
rhythm.eu(6, 3, 1) [0, 1, 0, 1, 0, 1]
makesection
def makesection(
k,
instrument,
length,
onsets,
stems,
stemsdir,
stemsext,
sectionname,
sectionindex
)
onsets
def onsets(
pattern,
beat=0.2,
length=30.0,
smear=1
)
Patterns to onset lists
pgen
def pgen(
numbeats,
div=1,
offset=0,
reps=None,
reverse=False
)
Pattern creation helper
repeat
def repeat(
onsets,
reps
)
Repeat a sequence of onsets a given number of times
Classes
Seq
class Seq(
/,
*args,
**kwargs
)
Class variables
instruments
Methods
add
def add(
self,
name,
pattern=None,
callback=None,
div=1.0,
numbeats=4,
swing=0.0,
barcallback=None,
sounds=None,
smear=1.0
)
play
def play(
self,
numbeats,
patseq=None,
stems=False,
stemsdir='',
stemsext='wav',
pool=False
)
score
def score(
self,
score,
barlength=4,
stems=False,
stemsdir='',
stemsext='wav',
pool=False
)
A score looks like this:
score = { 'seq': 'aaba', 'a': { 'instrument1': '1121', 'instrument2': 'gffg', }, 'b': { 'instrument1': '2211', 'instrument2': 'gggg', } }
Which corresponds to instruments like:
instrument1_patterns = { '1': 'xx.x', '2': '..x.', }
dm.add('instrument1', instrument1_patterns)
instrument2_patterns = { 'f': 'x...', 'g': '.xxx', }
dm.add('instrument2', instrument2_patterns)
update
def update(
self,
name,
**kwargs
)