Why code music?
Making music that sounds different, having more fun exploring music, performing live, and finding the international communities
TLDR; Making music with code lets you access new sounds, particularly via sound design, new rhythms, and new harmonies. These can be considered structures to “mutate” or experiment with, to determine what kinds of unorthodox things resonate with yourself and other people. Coding music doesn’t pigeonhole you in a certain style of music.
It can let you produce more efficiently, without sacrificing options to interface with traditional tools for music production (DAWs). Your compositions and productions can be published, backed up, and shared as executable, version-controlled sheet music using Github, the primary site for hosting open-source code projects.
Live-code performances and algoraves are a unique and engaging form of live electronic music performance that’s greatly improving in quality over time, like other musical practices. There are surprisingly accessible opportunities to perform at conferences and make strong connections with a worldwide community of computational audio and visual artists.
Make things sound different
The biggest reason for coding music: you can make things sound different. This is the most important and obvious reason for me, so let’s start with that, after a short intro.
Music evolves with technology
Maybe i should say “music mutates with technology” because evolution implies persistence and durability. “Mutation” means the new change can be a step forward or backward, which we all know more realistically reflects the nature of experimenting with music. :D
Persistence of a new musical form, or “incorporation into the zeitgeist” requires adoption by a subculture. I believe that’s mostly outside the control of the individual artist, although code artists are indeed influencing each other and gathering loyal fans who aren’t musicians. Of course, new music is also shaped by ideas and feelings (like attitudes and aesthetics). Yet sounds are undeniably important to the historical progression of music, and I liken coding music to using an open-ended modular instrument. It’s a new-ish technology1 that can help you access new-ish sonic possibilities. At the very least, it’s quite different from what most people are doing.
It’s a tool; use it however you like
You can code music that sounds mainstream if you’d like, or code full-blown futurist soundscapes that challenge your listeners. The continuum between mainstream pop and avant-garde is broad and fertile ground for exploration.
Coding music is a tool, not a genre. For an analogy, DJing is a tool for playing any kind of recorded music, though it’s technologically “strongest” for playing dance music. I do believe coding music is a “strong” technology for certain types of music, but that also depends on the coding language and what’s been implemented so far. I’m not going to go into that specifically here, but instead I’ll talk about what you can do with musical coding.
Musical structures to mutate
Three big ways to make things sound different are through unconventional uses of:
sound design,
rhythm and sequencing, and
melody and harmony.
I argue that these are essentially synonymous with anything that’s difficult to do with the popular commercial software tools for music production. Realizing “what’s hard to do” involved spending many years with my digital audio workstation (DAW) while always attempting to sound different. If you can think of anything major that I missed, please let me know with a comment.
More sound design opportunities
A motive for coding your music is that you can turn anything into sound.
Mathematics and complex data are some extreme examples. The musical coding language TidalCycles is based in Haskell, a language used for mathematical proof solving. You may have heard the sonification of sorting algorithms, an example of this idea that perhaps disregards musicality (I love it) but certainly solid art and entertaining for those intrigued by the algorithms. Audiovisual content on social media visualizing and sonifying polyrhythms, most notably by those by Project JDM and Virtual Riot, have amassed probably hundreds of millions of views. And algorithms from all places—quantum computing, robotics, training a neural network, etc—can be turned into sound. I’ve seen sonification of complex data from genomes, global carbon emissions, and of course, electrical signals from plants.
Another strong appeal of algorithmic music is fine-grained low-level sound design, meaning managing everything with mathematics and using the foundations of digital signal processing—sine waves, noise, and filters. It’s common to do this with SuperCollider, Faust, and csound languages. I’d recommend the excellent computer music blog by Nathan Ho for inspiration. For this kind of coding music, there’s also a new Python library, SignalFlow, developed by Ideoforms. If you want to stick to traditional methods like additive, subtractive, granular, and FM synthesis, you’ll find things to do that you can’t with plug-ins designed for consumers. Or you can even go as far as making hi-hats and other complex drum sounds from sine waves tuned to specific frequencies. Or simply use VST synths, effects, and EQ in a DAW for all the sound design and use your code just for sequencing (arranging your sounds in time)—this leads to novelty with relative ease.
It’s easier for microtonal composition
Sounds from nature are not melodically quantized to the 12 notes of the DAW and piano. You might argue those 12 notes are the best. People like Aphex Twin and musicians from Non-Western cultures would probably disagree.
Microtonal tuning systems like Just Intonation or 31-EDO have more frequencies compared to 12-TET and this makes them challenging. They are much higher-dimensional search spaces, which is to say, “finding the right notes” becomes harder, even if you know what you’re doing.
Exploring microtonal scales with a DAW or keyboard requires methodical patience and may involve calculating numbers and referring to tables of frequencies, ratios, or cents. Coding languages like TidalCycles or the microtonal-by-design language xenpaper offer quicker ways to explore tuning and harmony.
Some active microtonal artists worth listening to (with links to music) include Sevish, Zhea Erose, Brendan Byrnes, Xotla, Khyam Allami, Aleksi Perala, Nathan Ho, and Horse Lords. I’m also influenced by Wendy Carlos as well as gamelan (percussion music from Indonesia), and music from Mozambique and Arabic countries.
New rhythms are at your fingertips
When I first heard about TidalCycles in 2018, my current musical coding language of choice, one thing about it in particular convinced me to explore it deeply: Euclidean rhythms were basically the “Hello World” for this language. I had just read “The Geometry of Musical Rhythm” by the Harvard musicologist Godfried Toussaint. The book suggests several explanations for why certain rhythms sound good, including Euclidean rhythms. Toussaint explains how members of this Euclidean class of rhythms appear in dance music worldwide, including Subsaharan Africa, the Balkan peninsula, and Latin America. They are surprisingly important culturally and most were nice sounding.
For a brief explanation of what they are, Euclidean rhythms produce grid-quantized rhythms, maximally evenly spaced in time. They sound most interesting when an even number is divided by an odd number and when they’re co-prime, which leads to syncopation.
Other rhythmic ideas in musical coding languages include polyrhythms, hemiolas (polymeter), odd time signatures, and isorhythms (the nTake family of functions in TidalCycles). Typing different numbers is the easiest way to try out different variants of these rhythms—much less tedious than drawing MIDI rectangles in a DAW. Let the open-source algorithms do the heavy lifting for you.
Complete control over groove and swing is another benefit. Ableton Live’s groove files (.adg files) are in an obscured gzipped .xml format. They are parametrically limited and there’s no helpful visualization or information on what specific grooves do. It’s also unclear how they generalize to odd time signatures. Yet groove is fundamental for making dance music, particularly and most noticeably at lower tempos. It can also be used to humanize otherwise rigid-sounding computer-generated rhythms.
Deciding to use algorithmic grooves opens up satisfying possibilities. While I can’t find the original Instagram reel, there’s a Jacob Collier interview where he describes what makes a rhythm “wonky” (meaning off-kilter). He talked about Gnawa (Moroccan healing music) and Samba (Brazilian dance music). He beatboxed to mimic the way that the tempo of Samba accelerates and decelerates within a rhythmic cycle. “It sounds like a rolling egg!” he exclaims. After watching that interview I found a Stanford physics homework assignment that included the equations for the motion of a rolling egg. I wrote a TidalCycles function to add this groove to my beats. I first attempted and captured this in the latest song I released, “Egg Rolling” (code and music here). I was lucky enough to perform this piece at Stanford CCRMA, kind of coming full circle (dare I say, “full egg”).
“Egg Rolling,” a mix of 31-EDO, Euclidean rhythms, odd time, and the rolling egg rhythm:
let egg a b = sqrt $ ( (a + b*(sine*sine/cosine/cosine)) / (1 + sine * sine / cosine / cosine) ) -- egg rolling equations
rizz r p = (# nudge (fast r p)) -- same as groove
-- straight amen break, 0 is kick, 2 is snare, 4 is hi-hat.
d1 $ (|- n 24) $
n "0 0 2 [4 2] [4 2] [0 0] 2 [4 2]" # sound "midi" # midichan 0
-- egg rolled amen break
d1 $ (|- n 24) $ rizz 1 (range 0 0.03 $ egg 6 1 ) $
n "0 0 2 [4 2] [4 2] [0 0] 2 [4 2]" # sound "midi" # midichan 0Amen break with
(top): no swing applied
(bottom) egg rolling swing applied.
The above swing example is essentially a specific way of modulating tempo with parametric functions like sine and cosine. A completely different approach is using rational numbers to displace rhythmic onsets, similar to how rhythmic grids in the DAW let you make rhythms with triplets and quarter/eighth/sixteenth notes, but in a more generalized, unorthodox-if-you-want kind of way. TidalCycles’ ‘mini notation’ lets you do this, among other cool things.
So coding opens up new possibilities for music through sound design, harmony, and rhythm. To me those three are the biggest reasons to code music. But there are more benefits to the practice that are worth mentioning.
Version controlled sheet music
When you write code for creative, non-commercial purposes, it’s common to upload the code to GitHub. This lets other people see and share your code. Also, the project exists there as an “undo” tree, meaning you can see previous states of the code. Every version is backed up for good and accessible from any computer. Doing this with musical code is extremely helpful. It’s way easier to manage than ‘project_v3_arranged_mixed_mastered_v2.als‘, and better than dealing with a DAW’s large project files, especially when raw Audio and VSTs are used. Plus you don’t need to worry about irreparably messing something up while you’re exploring ideas.
I also think of musical code as executable sheet music, meaning the code is a symbolic representation of the music, and when the numbers or symbolic structure changes, the music changes, perhaps in real time. Perhaps everything you hear is reflected in the code, or perhaps just the notes and timing, like sheet music or guitar tablature. Regardless of how one-to-one the code and audio are in someone else’s hands, the code is simultaneously the instructions for making the music and the origins of the music. So it’s useful for notation, sharing with others, as well as generating the music.
Aside: It’s an interesting exercise to see how many lines of code are needed to convincingly replicate an existing piece of music.
Coding music is less repetitive than sequencing in a DAW
As of 2025, most digital audio workstations (DAWs) like Ableton Live and FL studio, are not immediately or fully scriptable. Blender or TouchDesigner, two standard creative tools for visual art, are scriptable with Python out-of-the-box. The lack of a parallel for widespread tools for music production feels unusual to me. You will run into limitations of the software and be forced to wait optimistically for the next version release. Certain processes require clicking dozens or even hundreds of times to try out one idea. It’s not fun being forced to venture on a repetitive click-a-thon, just to audition an idea that might not even sound good after the fact, then having to undo everything. You’re at the whim of software developers who must satisfy the masses and may or may not reply to your requests. With coding music, if you’re savvy enough, you can implement the features you want, and never have to work repetitively.
Besides saving time so you can proceed to the next step in your process, there’s another reason why the speed of your workflow matters—auditory adaptation. Perceptually, the more you hear something on repeat, the better it sounds, sometimes deceivingly so. So unless you’re very good at taking listening breaks, workflow acceleration leads to higher quality music. It’s a bit like rock climbing: to get to the top you must “climb fast”.
In principle, doing things with code should make you faster at producing and composing. In practice, after the initial learning curve for coding music, the new possibilities open up different, more-interesting things to focus on, such as humanizing algorithmic patterns in a unique way. That’s yet another topic so I’ll save examples for another article.
You can interface with existing tools
Code musicians pick and choose which parts of their production process they want to do with code. You don’t have to do sound design from scratch or code your own audio processing algorithms. While you can work entirely with samples and no DAW, or entirely with synthesis and no DAW, you can find middle ground, which you might find to be the best of both worlds.
The way I like to interface with my DAW is to code expressions for MIDI note and MIDI CC data to control VST synths and their parameters, respectively. I then record all the data in my DAW, maybe changing some things after recording. I recommend Kindohm’s tutorial videos for how to set this up. It’s really enjoyable using a mix of music production tools and code. The DAW is not just for the sound. For me, the visual feedback and interfaces of the DAW make me a better music producer. The code makes the compositions sound different and more unique and makes the process more fluid.
Another strategy I use is playing something on a drum pad or MIDI piano keyboard, recording the MIDI, then translating it to code that can be displayed semi-human-readably and executed in a text editor alongside other pieces of code. My Python repo does the MIDI-to-code translation for me. This lets me improvisationally and algorithmically remix my piano keyboard solos during a live performance, using whichever mathematical transformations make it sound more interesting.
You can code live to perform, although you don’t need to have that expectation. Some artists use code purely for composing, coming up with new ideas, generating sounds, or sequencing then perform with a variety of musical interfaces. That said, it is fun to code in a live setting.
Coding music for live performance
There’s an international live performance movement called “live coding” where performers share the code on their screen, often on large projection surfaces. The audience hears the music change in real time as they watch the performer write or change existing lines of code and execute them. In some ways the movement helps make live electronic music performance interesting to watch. Sure, it’s going to sound more raw than a DJ playing an mp3 that was produced over several months. But it’s much more interactive and engaging. It’s live and verifiably non-pre-recorded. Showing your source code is not only “based”, it unveils the intricacies (or simplicity) of the music you’re sharing with people in the moment. There’s even an International Conference for Live-Coding, where participants hop between nightclubs, lecture rooms, media laboratories, and conference halls. Last year’s was in Shanghai, with 2025’s conference being held in Barcelona.
In live-coding, hybrid live setups are encouraged. Code hasn’t replaced knobs for adding continuous (or “analog”) changes to the music. Human control is an authentic fingerprint of the musician’s live performance. During performances I prefer to run everything through a DJ mixer, so I have immediate control over bass and loudness and can do subtle things for transitions (a little filtering goes a long way). I have also used a variety of MIDI controllers, but often perform without one.
Another appeal for live performance with code is the ability to connect the music to visuals or lights. This means you can do a full audiovisual live performance that can be as flashy as a visually-synchronized big room EDM DJ set. Except you won’t have to pretend it’s live. All the unique constructs for musical rhythms and arpeggiation in musical coding languages can be applied to DMX lights, the standard used in clubs and festivals.
Communicating with the audience through code comments is a nice memorable touch that I recommend. Engaging with the audience is arguably necessary in contemporary (mainstream) DJ sets, but for me, the tricks used by these DJs never feel natural when I’m on stage.
You can play paid corporate gigs for software companies
Although performing and collaborating with DIY music communities is my main avenue (working with likeminded artists is amazing), corporate gigs are a welcome spotlight and have led to valuable connections, in software and music.
I’ve performed at conferences for Github, Apache, xAI, Next.js, and I was invited twice to perform at Meta. All of these were through cold email invitations, which to me speaks highly to a) the newness and smallness of my field ( accessible-if-required dance music with code), b) the smallness of San Francisco, as well as c) the conversation-worthy mystique around the practice of performing music with code. People organizing these conferences are looking for entertainers who will do something that people will talk about.
Live-coding at Vercel’s Next.js conference, photo by Aurora Scharff
It’s ironic to me that the tech industry is often more supportive of this art form than the local music community. After all, the reason my friends and I code music is to make better music, not to showcase technology. Maybe the societal associations of coding leads to a misunderstanding. In a salient paper and video conversation (below) from 2024, and citing Cox and McLean (2012), Sarah Davis (DJ_Dave), Jack Armitage (Lil Data), and Gus Lobban (Kane West of Kero Kero Bonito) offered the following advice on this topic:
Engaging with live coding in a pop context requires being self-aware of how code is perceived by the general public. In popular media, the main references that are culturally associated with code are mostly negative: hackers and hacking, technosolutionism, tech bros and Silicon Valley, neoliberal capitalism, privacy invasion, surveillance, identity theft, and labor automation. These are both the first hurdles to overcome in communicating with code, and the factors to be aware of and sensitive to when bringing code into spaces where it may be perceived as insensitive or even threatening. These connotations are in stark contrast to those that the live coding community uplifts and celebrates: neurodivergence, community, open source, public commons, pedagogy, culture, craft and art. Also absent from the popular image of code is the long history of code art, aesthetics and poetry.
Sarah Davis and Jack Armitage, ‘Pop Live Coding Encounters’, presented at ICLC 2024 in Shanghai.
Social connections
While I’m obviously biased by personal experience, I can’t think of a better way to build a network of brilliant, creative, and talented people than being in the intersection of coding and live performance.
The network of people who produce and perform with code is likely under 1000 people and scattered across the globe, so you’ll quickly have opportunities to meet people worldwide. The global community is quite active and worth writing an article about on its own. There is emerging academic curricula on live-coding and algorave. AV Club SF and Livecode.NYC are the two biggest communities in the United States. And there are worldwide TOPLAP node communities and artist collectives. As live-coding performances frequently involve sharing the stage with a live visualist performer, you’ll also become acquainted with people whose work pushes the boundaries of live computer graphics and visual art.
The fields of computer music and visual art are intensely deep, so you’ll make strong connections over your shared unique interest. In a way, it parallels making friends through religion (i.e., going to church), because you meet people who value something bigger than yourselves. WE’RE NOT A CULT! But anyway, as a result, involvement in these communities leads to friendships based on mutual support, gratitude, and growing wiser with each other. You’ll get to keep up with people living exciting lives. Whether or not my analogy suits you, this kind of community support is invaluable in a difficult world, especially when dealing with frustrations with the music industry and a stark persistent paranoia that sounding futuristic will be uncool forever (I’m talking about Mark Fisher’s “Ghosts of my Life”). Despite the fact that I willingly spend more time on my laptop than I do with people, because of computer music and art communities, I’ve stopped experiencing loneliness. I’m really grateful I found a hobby that helped me find more satisfaction with life.
summary.close()
So why code music? It’s for the unconventional sounds, rhythms, and harmonies. It’s for better enjoyment of the music production process. And it brings opportunities for live performances and building meaningful connections with an international community. You may find your niche making music with code, or perhaps helping further the development of musical coding languages, or attending an algorave. If you’re a musician and a programmer (or just one of the two) I encourage you to give these things a try. Check out AV Club SF, Livecode.NYC, join the TidalCycles discord, join a TOPLAP node, or subscribe to my substack, instagram, or bandcamp for more from me. Thanks for reading.
Algorithmic music composition tools exploring unusual rhythms and harmony have been around for a long time. For an excellent example, Larry Polansky’s Hierarchical Musical Syntax Language was developed in the 1980s. What makes things exciting today is not the novelty. What seems to be different about today is the idea that algorithmic musicians are using contemporary music production techniques, blurring the lines between accessible, underground, and academic, getting booked for high profile events with general, non-computer-music audiences, writing code for live performances in the club and festivals, and the topic is infiltrating undergraduate art and music curriculum.




