
Aerodynamic by Daft-Punk in 100 lines of code with Sonic Pi - edouardb
https://aimxhaisse.com/aerodynamic-en.html
======
datajeroen
Hacker version of this: [https://github.com/substack/music-for-
hire](https://github.com/substack/music-for-hire)

Some examples: [https://t.co/51cezrD9aZ](https://t.co/51cezrD9aZ)
[https://t.co/bUfCcAnSqX](https://t.co/bUfCcAnSqX)
[https://t.co/FyBHSbeAaT](https://t.co/FyBHSbeAaT)
[https://t.co/3r9FkxlguM](https://t.co/3r9FkxlguM)

~~~
runeb
Warning; turn down your volume before clicking on these examples. I'm pretty
sure my tinnitus got worse just now :(

~~~
larrymcp
Heh, this reminded me of when Z-100 used to say: "if it's too loud... _you 're
too old_."

~~~
baldfat
I have that quote on my guitar case. I always wore ear plugs at shows,
hypocrite and I STILL got tinnitus!

------
mitchtbaum
Very cool.

Why do you modify your code as it plays? Could you simplify and abstract your
expressions to call them along a predictable flow pattern? This reminds me of
Knuth's beautiful representation of recurrence relations:
[https://en.wikipedia.org/wiki/The_Complexity_of_Songs](https://en.wikipedia.org/wiki/The_Complexity_of_Songs)

(Aside: His later work on Constraint Based Music Composition
[https://news.ycombinator.com/item?id=9512962](https://news.ycombinator.com/item?id=9512962)
also offers some interesting insight as to what could come from algorithmic
musical composition.)

~~~
samaaron
You don't need to modify your code as it plays. However, if you do you turn
what's a more traditional composition style workflow into a much more
exciting, expressive performance workflow.

When I gig with Sonic Pi all I do is modify the code on-the-fly. It allows me
to react to the crowd, the environment and my feelings :-)

~~~
mik3y
Mad respect, this looks so inventive. But as a coder by day / vinyl and
controller DJ by night, shifting code around to gig sounds like a nightmarish
personal hell!

Am I missing something about how the tactile control works, or is it really
just shifting text around with a keyboard and mouse?

~~~
transpy
I'm a localization worker by day and DJ on the weekends... I understand your
point haha. But we can't escape the curse, I indeed try do 'different
activities' but at the end of the day I'm just switching laptops. Translate?
computer work. Programm? computer work. DJing? computer work.

------
samaaron
Great work with the tutorial! Thanks for jamming with Sonic Pi and sharing the
live coding love <3 <3

~~~
aimxhaisse
Thanks a lot for Sonic Pi and Overtone!

------
jsingleton
FYI there's a regular feature on Sonic Pi (by the creator) in the official
magazine. It's usually the only article in Ruby as the rest are normally in
Python.

It's a free PDF download but you can buy it to support them:
[https://www.raspberrypi.org/magpi](https://www.raspberrypi.org/magpi)

See page 48 (page 50 of the PDF): [https://www.raspberrypi.org/magpi-
issues/MagPi42.pdf](https://www.raspberrypi.org/magpi-issues/MagPi42.pdf)

~~~
justinclift
Yeah, I wish the language syntax in Sonic Pi was less Ruby, more Python. But,
seriously disliking Ruby is just a personal hangup. ;)

------
baldfat
Here is the video from OSCON in Amsterdam with the creator of Sonic Pi -
[https://www.youtube.com/watch?v=ENfyOndcvP0](https://www.youtube.com/watch?v=ENfyOndcvP0)

He is a very good speaker and got me excited to try to do some of this with my
9 year old daughter.

~~~
noir_lord
Agreed, for a short presentation that was one of the best speakers I've seen,
he mentions he works at a university in front of students so perhaps he is
comfortable in front of crowds and that combined with his obvious passion for
the subject shines through.

Wish I spoke that well, I'm not bad anymore but I'm also not that fluid.

------
duncanawoods
I'm interested in taking a closer look at one of Sonic Pi, Supercollider,
WavePot, Chuck, CSound etc.

Can anyone suggest how to choose which one to invest some time in?

~~~
jm547ster
It very much depends what your end goal is. Are you just looking to experiment
and make some sounds? Would you like to embed one of these as a sound engine
in another application that you are developing? Certain devices you are
targeting?

~~~
duncanawoods
I have no fixed goal so interested to know the different trade-offs between
each one e.g. which ones excel at different goals you suggest?

Also general comments about things like quality, extendibility, community,
momentum, learning curve, level of fun, reliability etc. would be really
helpful - thanks!

~~~
kindohm
If you're interested in rhythms and are open to using samples, you could take
a look at Tidal ([http://tidal.lurk.org](http://tidal.lurk.org)). Tidal is a
DSL embedded in Haskell, and can be used to very quickly create patterns of
sound: everything from house music to chaotic breakcore to abstract textures.
It's great for rhythm-based performance (and composition). It isn't as good at
melody, but it does have some support for MIDI output and melodic expression,
and with some effort your library of samples can support melody easily. I
found Tidal's learning curve to be very shallow, but I think it depends on how
you perceive music and rhythm. The Tidal community is working on a better
install experience right now (in the meantime you'll need to compile a few
things from source, etc). It primarily supports Emacs and Atom (Emacs appears
to be the most stable).

Edit: Tidal is great for both live-coding and static-composition scenarios. In
my opinion, it's ideal for live coding performance because minimal code is
needed to get sound going quickly.

------
dmoo
Also check out heliosphan recreation in Sonic Pi YouTube

[https://www.youtube.com/embed/bgPpyfRk3rw](https://www.youtube.com/embed/bgPpyfRk3rw)

------
harisamin
Super awesome. Here's my take on Arcade Fire's The Suburbs
[https://gist.github.com/hamin/1d3f45623b38504d72c8](https://gist.github.com/hamin/1d3f45623b38504d72c8)

------
canyonero
I've been listening to a lot of Daft Punk lately and have been building some
toy synths lately with the Web Audio API in JavaScript. I think I'll take the
weekend to mess around with Sonic Pi.

Great work, this is super cool!

------
jsmeaton
Awesome articles, thanks for writing them. I used to fool around with FL and
Reason about 10 years ago but wasn't very good at all. I think I could have a
lot of fun with this.

I especially liked how the author visualized sounds to be able to replicate
them. I always assumed you just had to have a good ear.

Really impressive stuff, thanks.

~~~
kriro
I'll agree. The visualization helped me quite a bit. Never heard of Sonic Pi
before this. It seems really cool. I also love that they have a dedicated "how
to contribute" page with examples for non-technical stuff as well:
[https://github.com/samaaron/sonic-pi/blob/master/HOW-TO-
CONT...](https://github.com/samaaron/sonic-pi/blob/master/HOW-TO-
CONTRIBUTE.md)

Prewrite some code, play around with it live...love it. Is there a curated
list of people using this for live performances? I'd love to attend one of
those.

~~~
juliendorra
For more on the live coding scene, check
[http://toplap.org](http://toplap.org)

------
agounaris
I've just learned about sonic pi yesterday and today this is first on HN ...
wtf who tracks me? :P

~~~
transpy
The other day I was searching about the best way to automatically detect
patterns in data. Then I checked my email and I had received a "Quora Session
recap" type of newsletter (I don't get or read those often). The content of
the newsletter was a series of questions about machine learning with Pedro
Domingos, (I didn't know him). I was amazed by his knowledge about computer
science. The next day I went casually to Amazon and it recommended me Pedro
Domingo's book 'The Master Algorithm'. I tried a sample and it blew me away:
it's a great exposition of what machine learning is. I bought the book and
keep reading. This is a bit meta, but I think machine learning helped me find
information to understand machine learning better. It chose me :)

------
runeb
Does anyone know of similar programs where the output is MIDI notes that you
can save to files or use directly in more traditional audio software like
Ableton Live?

~~~
baldfat
Sonic-Pi can play the file as MIDI you would then just record the notes into
Ableton Live.

Just looked at the cheat sheet. I would image all of these programs would be
playing out MIDI.

[http://www.cl.cam.ac.uk/projects/raspberrypi/sonicpi/media/s...](http://www.cl.cam.ac.uk/projects/raspberrypi/sonicpi/media/sonic-
pi-cheatsheet.pdf)

~~~
runeb
They seem to concentrate on generating sound, not MIDI, even if they can read
MIDI or use it internally. I'd like to generate my melodies algorithmically
and then use the MIDI output of these programs as input in Ableton Live, Logic
etc.

Also check out alda: [https://github.com/alda-
lang/alda](https://github.com/alda-lang/alda)

~~~
gosub
SuperCollider has a series of classes called Patterns for sequencing and
algorithmic composition. The output can be sent to the embedded server for
live synthesis or to a midi output (or directly to Ableton with a virtual midi
cable) [http://doc.sccode.org/Tutorials/A-Practical-
Guide/PG_Cookboo...](http://doc.sccode.org/Tutorials/A-Practical-
Guide/PG_Cookbook04_Sending_MIDI.html)

------
hugozap
That's really cool, I know nothing about music composition , where can I learn
the basic theory/concepts/etc ?

~~~
throwadeedee
bbc how music works will make a nice basic inctroduction

[https://www.youtube.com/playlist?list=PLA7obRrq8OgRX3y0yO0PI...](https://www.youtube.com/playlist?list=PLA7obRrq8OgRX3y0yO0PI9iDpxulWCxIr)

------
moul
Are you using your tool here [https://github.com/aimxhaisse/dummy-
wav2pi](https://github.com/aimxhaisse/dummy-wav2pi) for this song ?

~~~
aimxhaisse
Unfortunately no, I did this code while trying to reproduce the bell sound, I
thought it'd be easier to reproduce it by extracting the active frequencies of
the original sample, but I could merely obtain the timbre of the instrument. I
guess it needs more work (it doesn't take into account the envelope of the
bell) and more tweaks.

------
EugeneOZ
Move all moving parts to config (maybe inside this file even) to avoid jumps
between code parts.

Very impressive - not only work itself but also your feeling of rhythm.

------
danyim
The only thing that bothers me is that the bass track is off by a note.
There's a phrase in there that is supposed to go down the scale, but instead
it plays the same note three times. Otherwise, this is truly an amazing
recreation of the song.

You should tweet this to Daft Punk and see what they think!

------
7373737373
This is awesome!

Knowing nothing about this space, is there already a program that uses (wave
based) sound simulation to allow music programming in an arbitrary 3d
environment? This could go beyond mono and stereo :)

~~~
unwind
Something like Ambisonics
[https://en.wikipedia.org/wiki/Ambisonics](https://en.wikipedia.org/wiki/Ambisonics)
perhaps?

I once worked with a brilliant audio developer/wizard who used Ambisonics
(among other things).

Watching him position his desk when we switched to a new (large and open)
office space is something I'll never forget. He walked around in the middle-
ish of the room, snapping his fingers and listening. Suddenly he said "This is
it, I'll sit here", and so he did. :)

~~~
7373737373
This one seems to be static to the listener position and require more
hardware. Assuming only headphones are used, something like WAVE
([https://www.youtube.com/watch?v=ibM3fz-P0Ac](https://www.youtube.com/watch?v=ibM3fz-P0Ac))
could be used to simulate reflection, refraction, diffraction and interference
effects. If the head is accurately tracked, I could imagine 3d directional
sound programming in VR. Enter the Matrix rave ;)

------
pcx
For Daft Punk buffs like me, this is gold. Awesome stuff, kudos!

------
ilovefood
I totally love this! Great job man!

------
QuentinPerez
Awesome ! Added to my playlist :)

~~~
aimxhaisse
Glad you like it! Feel free to ask questions!

------
eivindga
Impressive!

------
jayzalowitz
Did he put out source, id love to edit.

~~~
aimxhaisse
Yes, it's available here at the end: [https://mxs.sbrk.org/aerodynamic-
everything-en.html](https://mxs.sbrk.org/aerodynamic-everything-en.html)

------
bchatelard
Nice!

------
sklivvz1971
Aerodynamic in 1 line of bash:

firefox
[https://www.youtube.com/watch?v=Mjpu0-o9iek](https://www.youtube.com/watch?v=Mjpu0-o9iek)

~~~
adrianN
That's not portable bash though. Could you maybe provide a Docker image with
the dependencies?

