Introduction: The First Usage of Sonic Pi
Today, I am going to show you how to use Sonic Pi program to produce music for anyone! For composers, for makers, for open-source music enthusiasts, for leisure time hobbies... That sounds good to us :D Special thanks for Sam Aaron!
The need list:
1. Your computer (Here I'll show on Windows, Raspbian (Raspberry Pi), Mac OS X)
2. Internet connection to download Sonic Pi
Although Sonic Pi is open source program to prepare musics, you can make a donation today to help creator to do beautiful things again for you.
Step 1: Download Sonic Pi
1. Open your web browser
2. Surf to http://sonic-pi.net/
3. Select your operating system
4. Download the program to your pc
Step 2: The First Code on Sonic Pi
On Windows, go to Start >> type "Sonic Pi" >> open the program >> write these codes:
>> volume up your speakers till between %60-70 or to your want >> Click on "RUN" button >> Enjoy!
You can use STOP button to stop the actual music, SAVE for saving the codes, REC for making the voice file.
Also, if the codes seem tiny, you can enlarge by clicking on SIZE- and SIZE+ buttons.
There are ALIGN, INFO, HELP, and PREFS buttons to use.
On preferences, you can modify your music editor's color, full screen, log options e.t.c.
Note: play 60 is the function that the note to play (as a MIDI number) then sleeps 1 second. The Sonic Pi Cheatsheet PDF file includes some detailed brief for notas.
Step 3: One Sample
On your Sonic Pi program, there are list view located on the bottom-left panel. Go to 3 Samples among others on the list, and choose whatever you want. I am sharing some example codes:
sample :loop_amen, norm: 1, decay: 1
sample :ambi_drone, beat_stretch: 1 wait 1.7 sample :loop_amen, norm: 1, decay: 1 sample :ambi_drone, beat_stretch: 1 wait 1.7 play 65, decay: 1
You can listen this sound with click on play on Sonic Pi program or listen the file my-recordings.wav which is attached.
Step 4: Longer Track
On http://sonic-pi.net/ website, there are a lot of sample music codes. Such as longer track is like that: ACID WALK
use_synth :fm sleep 2 loop do 28.times do sample :drum_bass_hard, amp: 0.8 sleep 0.25 play :e2, release: 0.2 sample :elec_cymbal, rate: 12, amp: 0.6 sleep 0.25 end sleep 4 end end
use_synth :tb303 with_fx :reverb do |rev| loop do control rev, mix: rrand(0, 0.3) with_fx :slicer, phase: 0.125 do sample :ambi_lunar_land, sustain: 0, release: 8, amp: 2 end
control rev, mix: rrand(0, 0.6) r = rrand(0.05, 0.3) 64.times do play chord(:e3, :minor).choose, release: r, cutoff: rrand(50, 90), amp: 0.5 sleep 0.125 end
control rev, mix: rrand(0, 0.6) r = rrand(0.1, 0.2) with_synth :prophet do 32.times do sleep 0.125 play chord(:a3, :m7).choose, release: r, cutoff: rrand(40, 130), amp: 0.7 end end
control rev, mix: rrand(0, 0.6) r = rrand(0.05, 0.3) 32.times do play chord(:e3, :minor).choose, release: r, cutoff: rrand(110, 130), amp: 0.4 sleep 0.125 end
control rev, mix: rrand(0, 0.6) with_fx :echo, phase: 0.25, decay: 8 do 16.times do play chord([:e2, :e3, :e4].choose, :m7).choose, release: 0.05, cutoff: rrand(50, 129), amp: 0.5 sleep 0.125 end end end end
Step 5: The More Longer Tracks
We can use samples to write more longer track codes like this:
bizet_bass = (ring :d, :r, :r, :a, :f5, :r, :a, :r) #bizet_bass = (ring :d, :r, :r, :Bb, :g5, :r, :Bb, :r)
with_fx :reverb, room: 1, mix: 0.3 do live_loop :bizet do with_fx :slicer, phase: 0.125 do synth :blade, note: :d4, release: 8, cutoff: 100, amp: 1.5 end 16.times do tick play bizet_bass.look, release: 0.1 play bizet_bass.look - 12, release: 0.3 sleep 0.125 end end end
live_loop :ind do sample :loop_industrial, beat_stretch: 1, cutoff: 100, rate: 1 sleep 1 end
live_loop :drums do sample :bd_haus, cutoff: 110 synth :beep, note: 49, attack: 0, release: 0.1 sleep 0.5 end
live_loop :low do |idx| # idx = 0 synth :zawa, wave: 1, invert_wave: 1, phase: 0.25, release: 5, note: :e1, cutoff: (range 60, 120, 10)[idx] sleep 4 idx += 1 end
live_loop :lands, auto_cue: false do |idx| use_synth :dsaw use_random_seed 66679 with_fx :reverb, room: 1 do 16.times do ns = (scale :e2, :minor_pentatonic, num_octaves: 3) play ns.choose, detune: 12, release: 0.1, amp: 2, amp: rand + 0.5, cutoff: rrand(70, 120) sleep 0.125 end end end
live_loop :bikes do |idx| sleep 0.25 sample :guit_em9, rate: -1 sleep 7.75 end
live_loop :time, auto_cue: false do |idx| sample :bd_haus, amp: 2.5 sleep 0.5 end
Step 6: Bonus Video
This presentation was recorded at GOTO Amsterdam 2014 http://gotoams.nl
Sam Aaron - Postdoc Researcher at The University of Cambridge & GOTO Fellow
This talk introduces Sonic Pi, a music language and environment running on the Raspberry Pi specifically focussed on introducing core Computer Science concepts for KS3 students.
Step 7: BONUS: Reading This Instructable
NOTE: This instructable's step is aimed for visually impaired people to hear the sentences to learn what's going on here. Watch the video, it explains all steps.
NOTE: You can also listen the recorded musics on the video with voice.