<aside> 💡
Sonic Pi is a free, open-source programming environment designed for creating music through code. It was developed by Sam Aaron at the University of Cambridge and has become a popular tool for live coding performances, teaching, and musical experimentation.
</aside>
download Sonic Pi from sonic-pi.net
I started with the most basic command - playing a single note:
play 60
Ths plays middle C (MIDI note 60). When I first ran this, I was surprised how simple it was to make sound!
Next, I learned that to play multiple notes in sequence, you need to add pauses:
play 60# C
sleep 0.5
play 62# D
sleep 0.5
play 64# E
sleep 0.5
play 65# F
sleep 0.5
play 67# G
I experimented with creating a simple melody - this was my first musical phrase:
play 60
sleep 0.5
play 64
sleep 0.5
play 67
sleep 1
play 64
sleep 0.5
play 60
sleep 1
Writing out every note became tedious, so I was excited to find I could use loops:
3.times do
play 60
sleep 0.5
play 64
sleep 0.5
play 67
sleep 1
end
Sonic Pi includes many different synthesizers. These became my palette for sound design:
use_synth :saw
play 38
sleep 0.5
use_synth :prophet
play 50
sleep 0.5
use_synth :tb303
play 62