Strudel
Live Code the Groove with Strudel
Introducing Strudel, a language for live-coding music in the browser. Learn the basics and recreate two classic songs as a complete beginner with no prior music composition experience.
While LLMs can assist with Strudel, they are less effective than with popular languages like Python.
What is Strudel?
Strudel
is an open-source web-based live-coding language and an official port of the
Tidal Cycles algorithmic pattern language to JavaScript.
While Strudel can be used as a library into any JavaScript codebase, more familiar user interface is the Strudel REPL:
a browser-based interactive environment where you write code and instantly hear the results.
[expand: what is Tidal Cycles?]
[expand: what is REPL?]
[expand: more history about Strudel]
- Tidal Cycles (or Tidal, in short) is a software for making patterns in time, embedded on Haskell language.
- It has grown out a family of live coding languages called Uzulangs, including Strudel, Vortex (a port of Tidal to Python), and many more.
- A key design philosophy of Tidal Cycles is, as reflected in the name, the concept of cycles. This is naturally inherited by Strudel. See below for more details.
- It stands for Read, Evaluate, Print/Play, Loop.
- In fact, Read–eval–print loop is an existing term: "a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user." Check out more in the Wikipedia page.
- Strudel was originally created by Alex McLean and Felix Roos.
- Their original paper was uploaded on Zenodo in April 2023.
- Strudel's Github repository has the first commit record in January 2022, but the codebase was moved to Codeberg repository in June 2025.
There are experts who create unbelievable live-coded music with Strudel. Moreover, there are even professional DJs who use Strudel in live: read more on the Algorave Wikipedia page. Many impressive videos are available in Strudel Showcase and on Youtube, including this and this. On the other hand, I am a complete beginner in Strudel, and has never composed the music or made a beat.
Example and Basics
Let’s live code music with Strudel!
I know, this term sounds almost impossible, but yes we indeed can!
Play the following code, which is on Strudel REPL, and change few things while it is being played!
[expand: actions on code]
- If you want to mute some sounds, change the
$sign in front into_$to mute specific line. - Then, press "Ctrl + Enter" (a keyboard short cut of play). Any change will be reflected on the next cycle.
- Press "Ctrl + ." to stop the sound.
- To turn on the visualization, uncomment the
pianorollline and press "Ctrl + Enter".
So we did live code music on the web!
In the code above,
bd, sd, and hh represent bass drum, snare drum, and hi-hat.
The sequence c g e g represents C, G, E, and G notes.
Strudel has several standard sounds including piano, square and triangle.
For more basic Strudel syntax, please refer to Strudel docs.
From my experiences, Strudel is quite easy to start, and prior coding experience is not really important to use the language. However, understanding music theory or having experiences with composition or beat making is significant to use Strudel’s full potential. Sadly I only know the very basic of music theory, yet I was still able to create some interesting pieces through hours of learning and many more hours of struggling with LLMs.
The concept of cycles
Tidal, and thus Strudel, does not use BPM (beats per minute). Instead the unit measurement is CPS or CPM (cycles per second, or minute). Here are two philosophical quote from Tidal and Strudel regarding this design choice:
- For Tidal, time is cyclical and not linear. It means that when a cycle ends, a new one will follow.
- Tempo is based on perception. The choice of sounds also has an impact on the tempo feel. This is why the same CPS can produce different perceived tempos.
What does this mean? Let’s try some examples from the Strudel docs.
With Strudel’s default 0.5 CPS (i.e., 30 CPM), listen to the following three codes. Can you hear the difference?
[expand: can you hear the difference?]
- The first one may sound like 30 BPM, because there is one 'beat' in one cycle, and we have 30 cycles per minute.
- The second one may sound like 120 BPM, because now there are four 'beat'.
- The third one may sound like 60 BPM, since now there is hi-hat and the tempo feels slower again.
This is why “Tempo is based on perception.” Now we are ready to groove with Strudel!
1. Let's Groove
The first example that we are grooving to is “Let’s Groove” by Earth, Wind, and Fire (EWF), released in 1981. This iconic song shows the sound of EWF, and I also highly recommend their another great song “September.” [link: Youtube - Let’s Groove official audio] [link: Youtube - September official audio]
Below, with Strudel, I recreate the opening vocal melody, which later becomes the bass line, then add some basic drum patterns. The other instrumental parts were very challenging to recreate. Yet, I am happy with capturing the core groove successfully!
Building upon this, I experimented with extending the same/similar bass line that I coded to different genres; because it sounds fun! Below, the left variation is supposed to sound like “2010s pop bangers”, and the right one uses the “Waltz” (3/4) style.
Remember that you can live code with Strudel! Thus you can change, add, or remove any element or sound as you want in real-time. This means that you can not just make feedback on someone’s music, or do version control the music on Github, but also you can “code” the same piece with collaborators at the same time in the same page. Isn’t this amazing?
2. Seven Nation Army
The second example for our groove is “Seven Nation Army” by The White Stripe, released on 2003. The song is very well known for its easy, iconic guitar riff, and features many other great instrumental parts. Fun fact is that the song’s title originates from Jack White’s childhood mishearing of “The Salvation Army” as “The Seven Nation Army.” [link: Youtube - Seven Nation Army official audio]
Similar to the previous example, I recreate the song’s guitar riff and add some simple drum patterns.
Then I covered to make variations on the genres that I did not try previously. Three genres were chosen: “Bossa Nova” (left); “Half‑time trap” (middle); and “Techno” (right). Personally I like the Bossa Nova version the most! As a note for expert listeners, please understand the music may not actually fit into these genres.
Lessons Learned
Playing with Strudel was surprisingly educational. I gained a better understanding of music structure: how individual instrument layers sound like; how they interact each other; how sound is connected to the parameters that can be controlled; how rhythmic patterns combine with melody and create groove; and so on. Now I understand why the official Strudel homepage emphasizes ‘teaching’ as a main use case. Deep understanding of these musical structure must be essential for live code music.
Regarding technical side, LLMs were quite helpful for Strudel development. After learning through the Strudel docs and playing with basics, using LLMs was a effective way to learn a new language in a top-down approach. However, they were less effective than with other popular languages like Python. I needed to change many parts of the code to make it runnable and sound better. LLMs required many iterative conversations to reflect my idea and feedback in the code, not even always successfully.
Thus, I conclude that musical knowledge is indeed valuable in Strudel. I like music, but my musical background is not strong: casually playing piano, minimal bass guitar experience, and no formal training. Yet Strudel’s code-based approach felt familiar since I do code other languages. Combined with LLMs, I was still able to create impressive pieces (considering my background), in spite of zero prior composition or beat making experiences. With more concrete music background, the learning curve for Strudel would be significantly steeper, and the final results would be more complete and sound better. The tools are getting more open and powerful, but expertise must still matter.