Hacker News new | past | comments | ask | show | jobs | submit login
Sonic Pi – The Live Coding Music Synth for Everyone (sonic-pi.net)
301 points by graderjs on Nov 8, 2022 | hide | past | favorite | 64 comments



Everything live coding related is worth taking a look: https://github.com/toplap/awesome-livecoding

Live coding is how I learned to program and I am so glad that this type of computer music performance exists. I am currently doing my PhD on the topic! Programming as a performative act, with its own culture and music sub-genres. For those interested in helping / taking a look, I am currently trying to hack my own live coding environment based on Python asyncio mechanisms: https://github.com/Bubobubobubobubo/sardine I am a bit shy about it because I am light years behind the level of the projects that are posted on HN and that keep me inspired. I've taught myself how to do this basically by live coding ... a lot, with friends in France! Learning a bit of CS because of music.

EDIT: Sonic Pi is the environment that I used to learn the basics of programming!


What are your thoughts / experience with Extempore? https://extemporelang.github.io/


I am using some of the concepts that were described by Andrew Sorensen such as temporal recursion in my own project. Such a cool concept. Extempore is very interesting, especially all the low-level bits that are a bit hard to grasp without a solid background in engineering.


For anyone wondering, a lot of work on Sonic Pi recently has gone into integrating an Elixir backend to handle distributed jamming. It has Ableton Link support so it can easily be synced with a DAW and other apps. It can also control external devices via MIDI and OSC protocols more reliably as a result.


Sonic Pi is a wonderful project! Sam the creator is consistently friendly and helpful, if you get the chance to chat with him or to book him for a conference or a party you should on that opportunity.


Seconded. Watching a live performance by Sam really is something else.


Thirded... our world is a better place because of Sam and his contributions.


I adore this project. Just fun, creative and powerful stuff.

I worked with Sam to put together a special demo of it. Super fun :)

Music by DJ_Dave.

Short video, 6 minutes: https://www.youtube.com/watch?v=suH_goWVBeA


I don't know the alternatives but I'm a big fan of https://tidalcycles.org/. People really do crazy things, check out the videos on the front page.

I love when 2 DJs live-code together (on the same document! Editing each other's loops) or when a VJ live-codes some visuals in reaction to the DJ live-coding the music.


See also: https://supercollider.github.io/

Supercollider is another real time audio synthesis tool.


Sonic Pi is a Ruby DSL for SuperCollider.

Sonic Pi is awesome, but ike all DSLs, while making simple things easy it has its limitations.


Sonic Pi is essentially a frontend to Supercollider: https://github.com/sonic-pi-net/sonic-pi/blob/dev/SYNTH_DESI...


For those looking to start understanding the fundamentals of synths and sound, check out https://learningsynths.ableton.com/en/get-started (and the recently posted https://ciechanow.ski/sound/ ). A great little explorable on the basics.


Live coding music is nice, but the interface is awful.

Having someone type at a laptop is so boring to watch, it totally kills the mood.

I'd rather have them manipulate lego like bricks on a physical screen or even write on a chalkboard...

Something has to be better than this


Perhaps ORCA [1] might pique your interest. I've mostly bounced off of live coding because of the interface issue, but something about the ORCA interface tickles my eyeballs and gets the creative juices flowing.

Shameless self-promo example of the language in action [2]

[1] https://100r.co/site/orca.html [2] https://youtu.be/fhYi958qqac


I thought the same. And thanks for sharing your compositions -- I particularly enjoyed "killed in the light of a crescent moon".


Hmmmm why my first instinct is to agree with you wholeheartedly, after a few moments of reflection I start thinking “well isn’t that the actual point here?”

Perhaps the program designer wants people to see actual coding as an artistic expression, which of course all real programmers know is very true, and not as some nerdy boring thing that lets-face-it…many non-programmers think of it.

That’s why personally I love the idea of the real time collaboration additions that are coming online these days. Like what could be better to promote coding then seeing a couple of people go fucking off sitting behind keyboards making interesting music together?


You might be interested in the approach Author & Punisher has taken.


If you continue the live coding (thought) experiment, you would naturally code a better interface. At that point you would be reinventing something like Ableton Live, but completely different. Similar to how using Lisp for a project develops its own DSL for the application different from other DSLs for other applications.

So we'd be watching someone simultaneously live code/play music and live code their interface.

Personally, I'd rather let them code the interface off stage and watch the live performance. After all, using the interface is live coding, but using the pre-built DSL.


Right, good point.

In some ways, sonic Pi is already a higher order interface than whatever language it's written in.

I am mostly talking about the way of inputting the code though. Having someone bent over a laptop is fairly disgraceful.. Maybe people said the same when knob-turning DJs appeared.


This is a good 1-'man'-show[0] TEDx, where watching someone program/fiddle with (software and) knobs is great to watch. Talk's good too--build-up to performance/demo is about halfway through.

[0] https://www.youtube.com/watch?v=q5yxIzs5Wug


I don't think "live coding" music means that musicians would actually write code in front of an audience live -- it's not like musicians compose music in real time even without computers. In either case there is a lot of trial and error in getting things right that you wouldn't want an audience to see (or hear). I think "live coding" is just a fancy way of saying a programming experience with immediate feedback -- like a REPL but even more so.


There are many musicians who "build" music in live concerts with modular synthesizers (in newer times mostly with Eurorack modules). Since many decades! Without computers. With some experience they know how to handle their tools. And with some experience a good live coder can do the same with his computer too.


I've seen performances where the live coding is just them building those same modular synths just digital. They start with a patch, and know what patch they need to end in. Everything between is up to them. Wish I had a better look at what they were doing.


I used to have this complaint until I saw someone do it well. The key is that can't be all their doing. One guy I saw was doing it at audience level while also being in the pit and moshing. Not sure I'll ever see anything like that again.


The interface is designed so that a 10-12 year old can write music-making code with little guidance. I have anecdotal evidence that it's quite good for that purpose.


See also: https://100r.co/site/orca.html

From the site:

ORCA is an ... esoteric programming language ... capable of sending MIDI, OSC & UDP to your audio interface, like Ableton, Renoise, VCV Rack or SuperCollider.


I've spent some time trying to work with Sonic Pi, but I've really struggled with the syntax, finding it difficult to work with. I'm fluent in Python but find the use of colons is the real sticking point.

If anyone's got any suggestions, or can point to a python version of the same (I spent a fair bit of time working with FoxDot which does use python so it made more sense to me) it'd be appreciated - this is something I'd really like to get into, but have found the hurdles a bit too tall!


> I'm fluent in Python but find the use of colons is the real sticking point.

The you'd probably have hated its predecessor which was all about the parentheses: https://overtone.github.io/

It's too bad that superficial stuff like which characters you need to type is holding you back. Getting used to Ruby when you're familiar with Python is no big deal. I would just stick with it


Agreed! OP: Do you think Ruby is the last language you'll have to learn? ;-) Stick with it, sonic-pi is worth it!


For what it's worth, I have a python background and Sonic Pi was my introduction to Ruby too. It does feel a bit weird but the built in tutorials are really quite good. You can get pretty far just copying and pasting samples. Play around until bits of it start to make sense.

If you just don't want to mess with Ruby, there are python libraries for supercollider (the same backend that Sonic Pi is using). The only gotcha is I think a lot of the value of Sonic Pi comes from the built in samples and synths.


FoxDot is probably what you're looking for.

https://foxdot.org/


They actually mentioned FoxDot in their comment, so they're already familiar. Plus, FoxDot is no longer being actively developed.


First learned of Sonic Pi in Dylan Beattie's "The Art of Code" NDC London conference[1]. Overall a very interesting watch; the particular segment mentioning Sonic Pi had really piqued my interest towards this wonderful piece of software.

[1] https://yewtu.be/watch?v=6avJHaC3C2U


Thanks for sharing. It is by no means new and I have seen it before. But that is such an incredible presentation!


This project is like magic, though really hard to install on it's own. Hence the approach that is advised is to run it on a Rasberry Pi (something like a physical docker container). This project duct-tapes so many cool technologies together that the whole setup become quite brittle: you need the exact versions of all dependencies + patches + wiring/configs and only then it works.

It's very complete: the "language" (Ruby with some libs), IDE, sound generation... It truly comes with batteries included.

I tried to put this project in a docker container (before snap and flatpak were all the rage; I've a bit of experience with snap and sure it did cause rage): that is a docker container that should be able to draw an X11 window in the host OSes X11 server. This to allow the project to be run with all its dependencies included. Sadly I failed.


I agree that the install is hard on linux but there are prebuilt packages for Windows and MacOS. There's no requirement to use a Raspberry Pi.

A long time ago (2017) I did successfully get Sonic Pi running in Docker but it wasn't straightforward https://github.com/xavriley/sonic-pi-docker If anyone wants to pick this back up I'd be happy to help


There are actually prebuilt packages for Debian as well, which can also work on Ubuntu.

I compiled it myself on Fedora and it works great. It wasn't too hard. Perhaps I should just document the steps somewhere.

What I tried and failed was to run it on OpenBSD. I spent all my free time in the evenings for about 2 weeks before I eventually gave up and moved to Linux. I agree with parent post that Sonic Pi is essentially a bunch of stuff duct taped to each other. Which is nice because it can do many things, but it is definitely not a very clean architecture and not easy to port.

Glicol has a much much nicer architecture. It is written in Rust and doesn't even depend on SuperCollider! It is so portable that it even compiles to WASM and runs in the browser. But I find Ruby easier to understand than Glicol's own language, plus ... I like Sonic Pi's feature completeness. It comes with plenty of pre-defined synths (not just sine/square/sawtooth, but some actually very complex stuff). It comes with many filters and sample manipulation tools. You can connect MIDI inputs with just a couple of lines of code... So yeah, I hate it and I love it at the same time!

No idea about the performance on RPI, do you guys find it acceptable? I am actually just thinking to use an older laptop as a "physical container" for Sonic Pi. Essentially a laptop that is only meant as a musical instrument, and it always just works (after the initial setup).


> There's no requirement to use a Raspberry Pi.

I know! But trying install it on Linux I did understand that the RPi route effectively "containerizes" the app :) That's what I meant to say by my comment.

> I did successfully get Sonic Pi running in Docker but it wasn't straightforward

You succeeded! Nice work.


they break the install in official repos too.


I was today years old to learn that something like this exists. I'm a coder, and I love music. I know how to spend the next couple evenings. That's awesome!


Sonic Pi is actually a pretty damn good synth. I played around with it a lot. It's not just a for-the-sake-of-code synthesizer.

I got some Guitar pieces from freesound.org and built an electric guitar synth. I then mixed it with some Tibetan Fire Priest chants and built this:

https://soundcloud.com/user-408150882-831970789/rhythm-of-ka...

As some of the comments here specify, the UI isn't exactly conducive to building 'heavy' music.

For instance, something that I built this morning using Kontakt (https://soundcloud.com/amal-krishnan-103125344/megatherion-p...) is painful to develop on SonicPi. Of course, SonicPi can be extended to perform some of the functionalities you'd expect a professional synthesizer to do. {DOS->Win 3.1}

There are some other issues as well centered around 'coding for developing music' and 'live coding'. Everything you build in the code --when I last checked-- goes into one stream. You really have to visualize time flow outside of the software. This makes editing chunks hard. A UI based synthesizer is a lot easier to work with: turn a few knobs and push a few keys as opposed to coding. Live Coding never really works in practice, and I'm talking about performing at the professional DJ level. It's easier to use a 'GUI' (a synth front end with its knobs etc) as opposed to code. Music tends not to flow 'rationally; inspiration tends to externalize in a kinetic fashion.

All that said, Sonic Pi is a rich platform to build synthesizers and pieces to go with the other tools in your music building deck.


Have been trying to get into live coding, mostly with Supercollider but Sonic-Pi looks nice as well (certainly less verbose). On the composition side of things it seems to be fantastic, I've used a lot of Renoise and this way of doing things just feels like a more direct way of what I was trying to do there, really nice.

The big drawback for me so far has been sound design. Actually building your own synths can be difficult to even get the basics down, working with samples is predictably a bit of a pain (to the point where I intended to just use synths for everything, drums included), and it doesn't look like many of these tools provide an easy way to reuse synths you've made before in different files.

I know that a lot of the time you can plug these tools into a traditional DAW, which obviously fixes the sound design issue, but this is the kind of thing I'd only really want to use standalone. Maybe its just a part of the learning curve, and eventually sound design gets more intuative.


I think it's not really intended for synth design and complex sound design, it's more akin to an instrument than a DAW. If you read the source code for Sonic Pi you'll see that most the synths are implemented in SuperCollider language or Clojure using the Overtone library, not Ruby/Sonic Pi.


Didn’t Renoise have some sort of Lua interface? In theory it should allow doing what this is doing, and more.


It does, but it ends up working a little bit like using a regular live-coding language with a DAW in that your switching between the two tools. Plus, from what I can remember in Renoise its largely about populating the tracker interface itself rather than values, which makes the whole live portion of it a bit more challenging


Somewhat/very related: https://glicol.org/

https://github.com/chaosprint/glicol

> Graph-oriented live coding language and music DSP library written in Rust


I recently was trying this again, also searching online for people using it, and I could only find club music made with it, which made me just give up on trying further. I wish there were some YouTube channel what made nice music with sonicpi or similar.


I’ve got a few pieces here which aren’t all dance (e.g. live coded sampling of bass guitar) https://www.xavierriley.co.uk/talks/

@rbnpi has also done some lovey work with classical music that’s worth checking out


Can you give a better definition than nice music?

I think one reason why tools like this lead to creation of dance music is that the structures are readily created using them, and in addition they tend to make synth and sample sounds which are often heard in dance... It's pretty quick to code a 4 on the floor dance beat, but programming Gene Krupa will be much more challenging!


You'd most likely just treat is as another synth - write "code" to make the sounds then "data" to just feed it notes.

And making traditional song wouldn't be as interesting demo for it I'd imagine


"nice music" I mean music that is not repeating with a period of less that 8 seconds. I don't care for a 3-loop made using code. I know it can be done, and I know it's easy to do compared to other ways. I wanna see if it's possible to use code as an real instrument.

Yes, a keyboard and a looper can be used for club music. Same for sonicpi. But a keyboard can be used to play/compose classical, or even "The Office" intro. Can sonicpi be used for that? That's what I wanna see.


Look into Alda music programming language - it's possible to write classical music with it. It's more like MIDI or classical notation - you don't care about sound but you specify notes.

https://alda.io/


Sonic pi totally can be used for that - I've made some classical compositions with it, however not live. I've really needed pre-built abstractions to get to the point where I can improvise akin to when I play a guitar or saxaphone.


yes, tho, verbose… you may have a better time using Csound and its score paradigm! http://www.csounds.com/manual/html/ScoreTop.html


You might like (Extrmpore author) Andrew Sorensen’s piano live coding:

https://youtu.be/bq-260NUw5o


I downloaded Sonic Pi years ago but haven't given it a proper try. I'm really looking forward to playing around with it again. Playing around with music can be such a fun creative outlet!

This is only slightly related but since others are sharing their live coding resources, I've had a lot of fun playing around with this one in the past: https://livecodingyoutube.github.io


Note that Sonic Pi is also available on other Linux distributions (Debian and Manjaro have it, didn't check others), presumably built and packaged by the community since it appears from the homepage they support only the ports linked from there. This is important especially now that used mini-pcs are so easily available and cost a fraction of a mostly unobtanium Raspberry PI.


I just lost 30 minutes down this rabbit hole. I am so excited to get into this.


I want to learn synthesis, but want to make pop songs as good as "Closer" by The Chainsmokers, any idea where to start?


I learned a lot about synthesis and sound design from Sonic Pi, and yet Sonic Pi goes much much further than being a synth, since it also works with samples, and most importantly with time and synchronization! No idea about the chain smokers, but my guess is that you can create essentially anything in Sonic Pi, especially if you bring in your own samples.


Oh my I remember using this like 6 or 7 years ago on a pi B+. It looks nearly identical!


Anyone know how this compares/fits with pure data?


Is there a Python library to create MIDI easily?




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: