Skip to content

Instantly share code, notes, and snippets.

@euwbah
Created December 18, 2014 16:30
Show Gist options
  • Save euwbah/66c801151019248e7335 to your computer and use it in GitHub Desktop.
Save euwbah/66c801151019248e7335 to your computer and use it in GitHub Desktop.
Testing out sonic pi for fun! Seems better than ChucK and super easy to learn! XD
# Welcome to Sonic Pi v2.1.1
define :Cm9 do |time|
play [:C4, :G4, :Bb4, :D5], sustain: time - 0.25, release: 0.25, decay: 0.1
play :G5, sustain: time - 0.25, release: 0.25, decay: 0.1 if one_in(2)
end
define :Eb9 do |time|
if one_in(2)
play [:Eb4, :Bb4, :D5, :F5], sustain: time - 0.25, release: 0.25, decay: 0.1
play :D6, sustain: time - 0.25, release: 0.25, decay: 0.1 if one_in(2)
else
play [:D4, :Eb4, :Bb4, :F5], sustain: time - 0.25, release: 0.25, decay: 0.1
end
end
define :Gm9 do |time|
play [:G3, :D4, :F4, :C5], sustain: time - 0.25, release: 0.25, decay: 0.1
play :A4, sustain: time - 0.25, release: 0.25, decay: 0.1 if one_in(2)
play :Bb5, sustain: time - 0.25, release: 0.25, decay: 0.1 if one_in(2)
end
sample :drum_cymbal_open, attack: 0.05, sustain: 0.3, release: 4, rate: 0.3, amp: 0.3
sample :drum_cymbal_open, attack: 0.05, sustain: 0.3, release: 4, rate: 0.4, amp: 0.3
sample :drum_cymbal_open, attack: 0.05, sustain: 0.3, release: 4, rate: 0.5, amp: 0.3
in_thread(name: :drumloop) do
live_loop do
sample :bd_zome
sample :drum_cymbal_open, sustain: 0.25, release: 0
sleep 0.25
sample :bd_zome
sample :drum_cymbal_closed
sleep 0.25
sample :drum_snare_hard
sample :drum_cymbal_closed
sleep 0.25
2.times do
sample :drum_cymbal_closed
sleep 0.125
sample :drum_snare_soft
sleep 0.125
end
sample :drum_bass_hard
sample :drum_cymbal_open, sustain: 0.25, release: 0
sleep 0.25
sample :drum_snare_hard
sample :drum_cymbal_closed
sleep 0.25
sample :drum_cymbal_closed
sleep 0.25
end
end
in_thread(name: :chords) do
live_loop do
3.times do
use_synth :fm
Cm9 0.8
sleep 0.75
Eb9 0.8
sleep 0.75
Gm9 2.5
sleep 2.5
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment