Do you like music? Do you like programming? Strudel is a neat project, which allows you to make music in a programmatic fashion. Recently I have been having a little fun with it. Have a listen.
Here is a brief rundown of Strudel and a few tips which help when using it.
Why Strudel?
There is a lot of music making software out there, but Strudel has several nice properties:
- It is AGPL open source
- It has an online REPL making trying it out trivially easy
- It has excellent documentation
- It has a good range of built in samples
- It can import other samples easily
- It has good visualisation options
- There is an alternative REPL mirrored at patternclub though it seems less up to date
Strudel is a JavaScript version of a project called TidalCycles which is written in Haskell. Therefore if you prefer Haskell syntax you may want to look at TidalCycles. Unfortunately TidalCycles does not appear to have an online REPL and installation on Windows is not trivial.
There is also a Python version of TidalCycles called Vortex. However as of 2025 Vortex is billed as “free as in puppies”. Once again Vortex is not as accessible as Strudel.
There is also Sonic Pi to consider if you are looking for a C++ based music live coding experience
Strudel Online REPL
The easiest way to get started with Strudel is to use the online REPL at https://strudel.cc/. There are several neat things about this REPL:
- It has a built in API reference on the right
- It comes with numerous instrument samples but you can load more direct in the REPL
- It stores your code in the URL making it easy to share a tune you have created
- It gets you up and making music very quickly
Another nice feature of Strudel is that the REPL can be embedded in other webpages. You can see examples of this below.
Getting Started
When you first open up the Strudel REPL it will have a simple tune in it. Press play to hear it, then change a few values and press update to see what happens (you can even do this in embeds in this article though you will need to stop and start the playback in that case). After that is likely time to dive into the documentation to see what other options are available.
Some Handy Strudel Hints
Firstly use the documentation and the quickstart workshop, they are really good and will get you up to speed quickly. The basic syntax is JavaScript like with methods being applied to sound and note objects. You can chain multiple methods onto a sound or note, be aware that sometimes order of operations matters. using $: in front of several sound or note patterns means they will be played in parallel, otherwise only the uppermost will be played.
Drum sounds have handy two character short codes as shown on this diagram. However some are not on the diagram: cp for clap, tb for tambourine and cb for cowbell, there is more on percussive samples here. Which bank the percussion sounds are drawn from can be set with the bank command. If you want to give another sound a short code you can easily do this using soundAlias. Information on loading custom samples is here.
Strudel uses punctuation in a format called mini notation. There is a handy table covering what punctuation does what in the documentation. You might notice that curly braces are missing from the list, according to patternclub they are used for polyrhythms. There is also a second format called Mondo notation, but support for this appears to be a work in progress.
While most of the code examples enclose sound and note patterns in speech marks, it is sometimes better to use backticks. This is because backticks can be used for patterns spread across multiple lines while speech marks cannot. This makes it easier to format for readability.
Visualisations are your friend. Strudel makes it very easy to visualise the notes being played, you can even colour code things. This is super handy for those of us who are not experienced composers. Probably the most useful is _pianoroll which comes with a lot of options which can be passed as a dictionary as described here.
One nice thing about Strudel is that the interface box outlines the notes currently being played. However an annoyance I had was that silent notes (- or ~) are not boxed when they are played. I found a neat solution to this is to alias a short code like ~~ to silence and use that instead:
Not sure what values to use for some of the functions? No problem just use a slider to control that variable. Its worth noting that at present it seems like slider’s have a minimum value of zero:
Handy Sources of Samples
Strudel comes with a large number of instruments baked in but you can easily load more. Here are some useful sources:
https://github.com/tidalcycles/Dirt-Samples
https://github.com/ilesinge/samples4web (MIT Licensed)
https://github.com/thedudesinc/strudel-library
and here is a library of some well know tunes recreated in Strudel
https://github.com/eefano/strudel-songs-collection
Strudel Live Coding Examples
part from experimenting for yourself, one of the best ways to see what Strudel can do is to look at some of the live coding demos people have posted. I can recommend:
- Switch Angel especially her narrated demonstration and her github scripts
- DJ_Dave and her dance example
- LearningTheWires who makes great use of constants and sliders
- oazoor with some more mellow music
There is a huge amount of depth to Strudel with different ways to create, arrange and modify music. If this appeals to you then happy coding.