Skip to content

Instantly share code, notes, and snippets.

@interstar
Created April 16, 2016 00:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save interstar/195f08f0441afff6760d09a368e8b391 to your computer and use it in GitHub Desktop.
Save interstar/195f08f0441afff6760d09a368e8b391 to your computer and use it in GitHub Desktop.
Started as a quick play with Sonic Pi to see if I could create functions that process and transform sequences of notes. Grew into a tune.
define :trans do |xs, d|
return xs.collect { |x| (x+d) }
end
ritmo = [0.2,0.4,0.2,0.4]
i = [:c3,:eb3,:g3,:c4,:c3,:eb3,:g3,:c4]
iv = (trans i, 5)
v = (trans i, 7)
with_fx :reverb do
with_fx :wobble, phase: 1.6, mix: 0.5 do
live_loop :riffs do
use_synth :dpulse
play_pattern_timed i, ritmo, amp: 0.4
play_pattern_timed iv, ritmo , amp: 0.4
play_pattern_timed v, ritmo , amp: 0.4
play_pattern_timed i, ritmo , amp: 0.4
end
end
end
live_loop :drums do
11.times do
sleep 0.4
sample :drum_cymbal_open, amp: 0.5
sleep 0.4
end
sleep 0.4
sample :drum_cymbal_closed
sleep 0.2
sample :drum_cymbal_open, amp: 0.7
sleep 0.2
with_fx :reverb do
with_fx :flanger do
sample :ambi_haunted_hum, rate: [0.1,0.1,0.3,0.3,0.5,0.5,0.7,0.9,0.9,1].choose() if one_in(12)
end
end
end
live_loop :kicksnare do
sample :bd_klub
sleep 0.8
sample :drum_snare_soft
sample :bd_klub
sleep 0.8
end
notes = (scale :c4, :minor, num_octaves: 2).shuffle
with_fx :reverb do
with_fx :echo do
live_loop :melody do
use_synth :piano
play notes.choose(), amp:2
sleep [0.4,0.8,0.8,1.6,1.6,3.2].choose()
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment