Programming is one of our most creative tools and with Sonic Pi by Sam Aaron we’ve got a new fantastic programmable instrument that everyone can use. It’s basically a programmable synth that takes code instructions to play tunes, but the live loops feature take it a step future as you can play and write code at the same time. This way Sonic Pi and programming can be used to do live performances. The software is open source and available for free for Windows and macOS and comes pre-installed on NOOBS for Raspberry Pi.
So before you move on, please Download Sonic Pi now!
I also highly recommend watching Sam Aaron’s awesome TEDx talk (25 min):
You only need to learn a few basic commands to get started making some melodies. After you’ve understood the basic commands you can remake known songs or make new songs.
To play a note the only thing you need is the
play-command followed by a number.
Enter this in the first buffer of Sonic Pi and hit “Play”.
TIPS: Use CMD+R (Run) as shortcut to start playing the current buffer.
To play a chord you can add a few more
play 72 play 75 play 79
Notice how the tones are being played at once.
To play notes one after another we need to use the
sleep-command followed by number of seconds.
play 60 sleep 0.5 play 62 sleep 0.5 play 64 sleep 0.5 play 60 sleep 0.5
Enter this in your buffer and run your program again. With only these two commands you can play many songs.
2.times do play 60 sleep 0.5 play 62 sleep 0.5 play 64 sleep 0.5 play 60 sleep 0.5 end
live_loop :foo do play 50 sleep 1 end
live_loop :foo do use_synth :prophet play :c1, release: 8, cutoff: rrand(70, 130) sleep 8 end live_loop :bar do sample :bd_haus sleep 0.5 end
Now checkout the references and please share what you’ve create with Sonic Pi!