Skip to content

Instantly share code, notes, and snippets.

@AlexandreRangel
Created December 25, 2016 23:33
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 AlexandreRangel/91e8c560ce1517a23b26417f10c84b76 to your computer and use it in GitHub Desktop.
Save AlexandreRangel/91e8c560ce1517a23b26417f10c84b76 to your computer and use it in GitHub Desktop.
Sonic Pi music code
# slowily melting the city v13
# Alexandre rANGEL
# www.quasecinema.org
# 25-Dec-2016
# Sonic Pi 2.11.1
use_bpm 62
set_sched_ahead_time! 8
set_volume! 0.8
ufo = "/Users/rangel/Documents/SamplesPi/ufo.aif"
bass = "/Users/rangel/Documents/SamplesPi/bass-slice.wav"
kick = "/Users/rangel/Documents/SamplesPi/kick-perc.wav"
# https://www.freesound.org/people/Omar Alvarado/sounds/115203 (ufo)
# https://www.freesound.org/people/johnnypanic/sounds/320817 (bass)
# https://www.freesound.org/people/ArcTis/sounds/347652 (kick)
live_loop :ufo do
with_fx :whammy, transpose: [8,12,16].choose, mix: 0.5 do
with_fx :slicer, phase: [0.25,0.5,1].choose, mix: rrand(0.3,0.7) do
sample ufo, rate: 0.5,
amp: 4.2, pan: -1, attack: 8
if one_in(2)
sample ufo, rate: 0.25, finish: 0.5,
amp: 12, pan: 1, attack: 8
else
sample ufo, rate: 0.25, start: 0.5,
amp: 12, pan: 1, attack: 8
end
end
end
sleep sample_duration ufo, rate: 0.5
end
sleep 32
with_fx :flanger, phase: 1 do
with_fx :echo, phase: 0.5, reps: 2 do
live_loop :bass1 do
with_fx :slicer, phase: [0.25,0.5,1,2].choose do
sample bass, attack: 0.15, release: 2,
amp: rrand(7,9)+rand(3),
rpitch: scale(:c4,:blues_minor,num_scales:3).choose,
pan: [1,0.5,1].choose
sleep 2
end
sleep 2 if one_in(2)
end
end
end
sleep 16
with_fx :reverb, mix: 0.7 do
with_fx :flanger, phase: 4 do
with_fx :flanger, phase: 1 do
with_fx :echo, phase: 0.5, reps: 2 do
live_loop :bass2 do
with_fx :slicer, phase: [0.25,0.5,1,2].choose do
with_fx :pitch_shift, pitch: rrand(-10,10),
window_size: 0.01 do
sample bass, attack: 0.15, release: 2, amp: rrand(6,10)+rand(3),
rpitch: scale(:c4,:blues_minor,num_scales:3).choose,
pan: [-1,-0.5,-1].choose
end
end
sleep 2
sleep 2 if one_in(2)
end
end
end
end
end
sleep 64
live_loop :kick do
x = tick
s = rrand(0,0.9)
with_fx :lpf, cutoff: rrand(80,120), cutoff_slide: 2 do
with_fx :slicer, phase: [0.25,0.5,1].choose do
with_fx :pitch_shift, pitch: rrand(-17,-15),
window_size: rrand(0.005,0.010) do
sample kick, amp: 1.85+rand(0.1), rate: 0.4+rand(0.1) if spread(7,[11,22].choose)[x]
sample kick, amp: 1.85+rand(0.1), rate: 0.8+rand(0.1) if spread(1,[4,8].choose)[x]
with_fx :flanger, phase: [0.25,0.5,1,1.5].choose do
with_fx :echo, reps: 2, phase: [0.25,0.333].choose do
sample kick, amp: rrand(1.85,2.1), pan: [-1,1].choose,
start: s, finish: s+0.1,
rate: rrand(1.5,2.5) if spread(5,[7,9].choose)[x]
end
end
end
end
end
sleep 0.5
end
sleep 8
live_loop :clap do
y = tick
with_fx :whammy,
transpose: [-16,-12,-10,-8,-4,-2].choose,
mix: rrand(0.2,0.4) do
sample :elec_blip,
pan: rrand(-0.2,0.2),
rate: [-1,-0.8,0.8,1].choose, finish: rrand(0.5,0.8),
amp: rrand(1.2,2)+rand(3) if spread(2,[2,4,4,4,6,6].choose)[y]
end
sample :elec_cymbal,
pan: rrand(-0.2,0.2), finish: rrand(0.01,0.48),
amp: rrand(0.18,0.333) if spread(8,13)[y]
sleep 0.25
sleep 0.25 if one_in(4)
end
16.times do
sample :bd_haus, amp: rand(2)
sample :bd_fat, amp: rand(1)
sleep 1
end
live_loop :kick2 do
with_fx :bitcrusher,
sample_rate: rrand(8000,44000),
mix: rrand(0.3,0.7) do
sample :bd_haus, amp: 1.8+rand(0.4)
end
sample :bd_fat, amp: rand(1)
sleep 0.5
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment