Sonic Pi is a coding music synth made for learning how to code while making awesome tunes!
- The real question is, why not use Sonic Pi? It's coding and music! What could be better than that?
- You can practice coding in ruby
- And practice your dj skills
- It's also set up with lessons, so you could teach kids/adults to code in a super fun way.
So, if you're convinced...
Using the command line, you can install it into the app you're working on like this:
gem install sonic-pi
**There's also a separate download with a desktop icon so you can code from their sonic-pi desktop app. http://sonic-pi.net/
- Play - Play is a method used like so:
play 40
play :C
- play correlates directly with actual piano notes.
- So, 'play 40' plays the 40th key on the keyboard.
- play :C plays the note C.
Adding play :C5 would play the 5th octave of C. <br>
- To get fancy, you could add s or b to signify sharp or flat<br>
- play :Cb => C flat<br>
<li> Sleep </li>
- sleep is the method that dictates how long to sleep. <br>
- So, the code sleep 1.2 would 'sleep' for 1.2 seconds.<br>
<li> Amplitude </li>
Amplitude is how loud the sound is.
- High amplitude produces loud sound, low amplitude produces quieter sound.
**default is amp: 1
example: play 60, amp: 0.5
<li> Synths </li>
Synths are some of the built-in sounds. There's a TON of built-in sound effects to choose from.
Synth is just one of those sound effects.
Syntax: use_synth
20 different synths to choose from
Sonic Pi is a fun way to code with Ruby and make music. A completed song would look like this:
use_synth :hollow with_fx :reverb, mix: 0.7 do
live_loop :note1 do play choose([:D4,:E4]), attack: 6, release: 6 sleep 8 end
live_loop :note2 do play choose([:Fs4,:G4]), attack: 4, release: 5 sleep 10 end
live_loop :note3 do play choose([:A4, :Cs5]), attack: 5, release: 5 sleep 11 end
end
To integrate Sonic-Pi into Atom, download the package below.
http://sonic-pi.net/ - Official Sonic-Pi Website https://atom.io/packages/atom-sonic - To integrate Sonic-Pi into Atom