Make music with patterns, in Python#
eddy is the pattern engine of TidalCycles, in Python. You describe rhythms and melodies as short patterns, and eddy turns them into sound. Every example on these pages runs in your browser. Edit it, drag its numbers, press ▶.
Press ▶ Play. That's a kick drum (bd), a hi-hat (hh) and a snare (sn), looping.
Now change it while it plays: click the code, swap sn for cp, and press ↵. The new beat comes in at the start of the next loop, without stopping the music. That's live coding.
Things to try
- Click a blue sound name like
hh: it cycles through the drum kit. - Add more sounds:
s("bd hh sn hh bd bd sn hh"). They squeeze in to share the same time. - Put
*2after a sound, likehh*2, to play it twice as fast.
Where to go next#
"…", with a live example each.
Why Python?#
TidalCycles is written in Haskell, and Strudel brings it to JavaScript. eddy is the Python member of the family, built on the pattern engine of Vortex.
A pattern in eddy is an ordinary Python object. So you can build one with a loop, keep a library of them in a module, generate one from data, or test it with pytest. And inside a marimo notebook, sliders and text boxes can shape the music while it plays. Python superpowers shows what that looks like.
Try it in a notebook#
Install#
eddy needs Python 3.10 or newer. The marimo extra adds the synth, the player and the live editor you see here (Python 3.11+).
pip install "tidaleddy[marimo]"
Then, in a marimo notebook:
from eddy.marimo import Repl
Repl('s("bd hh sn hh")')
How these pages work
Each example is a marimo island: a notebook cell running in your browser through Pyodide, a WebAssembly build of Python. When a page opens, Python starts and installs eddy, then the examples come alive. The first visit downloads about 25 MB; after that your browser has it cached. Nothing is sent to a server.