Creating and visualizing Rhythms#
In this notebook we will explore the generation and visualizations of rhythm patterns on a circle.
[1]:
from musicir.rhythm.generate import Euclid, RhythmViewer
%matplotlib inline
The Cuban Tresillo, the first bar of the “Son clave” can be define as a E(3,8)
[2]:
E= Euclid(3,8)
E
[2]:
X..X..X.
[3]:
E.beat.show()
[4]:
R = RhythmViewer(E.rhythm)
R.show()
Let’s hear it. By default the play method plays it twice.
[5]:
E.play()
To listen to more repetitions, we can use the get_beat to generate the stream with as many repetitions as we wish.
[6]:
st = E.get_beat(times=5)
st.show('midi')
The Quintillo is another well known Cuban rhythm.
[7]:
E = Euclid(5, 8)
E
[7]:
X.XX.XX.
[8]:
R = RhythmViewer(E.rhythm)
R.show()
[9]:
E.play()
[10]:
beat = E.get_beat(times=5)
beat.show('midi')
[11]:
beat.show()
[12]:
from musicir.rhythm import generate
[13]:
ES = generate.traditional_rhythms['samba']
[14]:
samba = ES.get_beat(times=3)
samba.show('midi')
[15]:
RS = RhythmViewer(ES.rhythm)
RS.show()
[ ]: