Rhythm model¶
The main building block of Beatsearch is the rhythm model, which defines two types of rhythms: monophonic and polyphonic rhythms.
Monophonic and polyphonic rhythms have common properties, such as tempo, duration and time signature. In the diagram displayed above, these properties live in the Rhythm node.
Monophonic rhythm¶
A monophonic rhythm consists of one single track (one instrument). To create a simple monophonic rhythm from a string:
from beatsearch.rhythm import MonophonicRhythm
clave_23 = MonophonicRhythm.create.from_string("--x-x---x--x--x-")
Polyphonic rhythm¶
A polyphonic rhythm consists of multiple tracks (multiple instruments). To create a simple polyphonic rhythm from a string:
from textwrap import dedent
from beatsearch.rhythm import PolyphonicRhythm
cascara = PolyphonicRhythm.create.from_string(dedent("""
clave: --x-x---x--x--x-
timbales: x-x-xx-xx-xx-x-x
kick: ---x------------
side stick: --x------x------
toms: ------xx------xx
"""))