Skip to content

Instantly share code, notes, and snippets.

@AlexandreRangel
Created March 10, 2016 19:22
Show Gist options
  • Save AlexandreRangel/92f126bbeb148fe3d8b5 to your computer and use it in GitHub Desktop.
Save AlexandreRangel/92f126bbeb148fe3d8b5 to your computer and use it in GitHub Desktop.
# Alexandre rANGEL
# "raining rage" (v11)
# www.quasecinema.org
# 10-Mar-2016
# Sonic Pi 2.9
arrangement = true
mybpmbase = 160
mybpm = mybpmbase
use_bpm mybpm
#use_sample_bpm :mySamples__dirty80bpm
startClock = 0 # 0 to start song at beginning
clock = startClock # global var
bar = 0 # global var
#set_sched_ahead_time! 2
set_volume! 0.82 #1.1 #0.75
t = Time.new
x = ((t.year - t.month - t.day - t.hour - t.min - t.sec) / 1.0).to_int
puts "x = #{x}"
use_random_seed = x
# http://www.freesound.org/people/Jovica/sounds/86578/
# http://www.freesound.org/people/patchen/sounds/24670/
# download samples, rename to dirty80bpm.wav and madrid.wav
# and put it in your path, defined here:
use_sample_pack_as '/Users/rangel/pisamples', :mySamples
load_samples [:mySamples__dirty80bpm,:mySamples__madrid]
load_samples [:bd_fat,:bd_haus,:bd_pure]
################################################################
live_loop :metro do
mybpm = mybpmbase #* (ring 2,2,2,2,2,2,4,2)[tick/128]
mybpm = mybpmbase * 2 if 1 == (ring 0,0,0,1,1,1,1,0)[tick/128]
#mybpm = mybpmbase * 4 if 1 == (ring 1,0,0,0)[tick/64]
mybpm = mybpmbase / 32 if bar == 0
mybpm = mybpmbase / 16 if bar == 1
mybpm = mybpmbase / 8 if bar == 2
mybpm = mybpmbase / 2 if bar == 3
with_bpm mybpm do
cue :metro
sleep 0.5
clock = startClock + tick
bar = (clock / 4) + 1
puts "let's go!" if clock < 1
puts "bar : #{bar}, bpm: #{mybpm}"
puts ring( "1 !","2 ! !","3 ! ! !","4 ! ! ! !")[clock]
end #mybpm
end #metro
live_loop :metro2 do
with_bpm mybpm do
cue :metro2
sleep 0.5
end
end #metro2
################################################################
#dirty intro
with_fx :echo, phase: 4, mix: 0.25, reps: 3 do
with_fx :echo, phase: 2, mix: 0.66 do
with_fx :lpf, cutoff: 75 do
sample :mySamples__dirty80bpm,
finish: (1.0 / 8.0), amp: 0.80
end #lpf
end #echo
end #echo
sleep ((sample_duration :mySamples__dirty80bpm) /8.0)
################################################################
live_loop :dirty do
with_bpm mybpm do
grid = 1.0 / [16.0,32.0,32.0,64.0,1024.0,2048.0].choose
x = grid*(rrand_i(0.0,grid).to_int)
if one_in(3)
with_fx :lpf, cutoff: rrand([0,32,64,72,102].choose,120),
cutoff_slide: 1.0/[8.0,4.0,2.0,1.0,0.5].choose do
with_fx :compressor, slope_below: 4.0, slope_above: 0.9, mix: 0.8 do
with_bpm 40 do
sample :mySamples__dirty80bpm, start: x, finish: x+grid,
rate: (ring 1,1,1,-1,1,1,1,-2)[tick/6]/(ring 4.0,2.0,2.0,1.0,1.0,1.0,1.0,0.5)[tick/6],
window_size: rrand(0.0001,0.0003), amp: rrand(2.0,3.6) * 1.1
sleep (sample_duration :mySamples__dirty80bpm)*grid *(ring 4,2,2,1,1,1,1,0.5)[tick/6]
end
end #compressor
end #lpf
else
sleep (sample_duration :mySamples__dirty80bpm)*grid *(ring 4,2,2,1,1,1,1,0.5)[tick/6]
end #if
end #bpm
end #dirty
################################################################
live_loop :madrid do
with_bpm mybpm do
with_fx :compressor, slope_below: 1.3, mix: 0.333 do
with_fx :slicer, phase: (ring 1,0.25)[tick/32],
mix: (ring 0,0.8,0,0.8)[tick/16] do
with_bpm 40 do
with_fx :echo, phase: (ring 0.5,1,2,0.25)[tick/2], reps: 2 do
grid = 1.0 / [16.0,32.0,32.0,64.0,128.0].choose
x = grid*(rrand_i(0.0,grid).to_int)
with_fx :pitch_shift, pitch: -16-[3,5,7].choose,
pitch_slide: 0.5,
window_size: rrand(0.0001,0.0005) do
with_fx :pitch_shift, pitch: -16-[3,5,7].choose,
pitch_slide: 0.5,
window_size: rrand(0.001,0.002) do
sample :mySamples__madrid, start: x, finish: x+grid,
rate: (ring 1,1,1,0.5,1,1,1,0.5)[tick/2]*(ring 4,2,2,1,1,1,1,0.5)[tick/2],
window_size: rrand(0.0001,0.0003),
pitch: [-48,-36,-24,-16].choose - [2,3,5,7].choose,
attack: 1, release: 2,
pan: rrand(-0.6,0.7), pan_slide: [0.25,0.5,1,2].choose,
amp: rrand(0.6,0.8)*rrand(1.0,1.11)
end #pitch_shift
end #pitch_shift
with_fx :pitch_shift, pitch: -16-[3,5,7].choose,
pitch_slide: 0.5,
window_size: rrand(0.0001,0.001) do
with_fx :flanger, phase: (ring 0.5,1,2,0.25,4,8)[tick/5] do
sample :mySamples__madrid, start: x, finish: x+grid,
rate: (ring 1,1,1,0.5,1,1,1,0.5)[tick/2]*(ring 4,2,2,1,1,1,1,0.5)[tick/2],
window_size: rrand(0.0001,0.0003),
pitch: [-48,-36,-24,-16].choose - [2,3,5,7].choose - 32,
attack: 2, release: 1,
pan: rrand(-0.65,0.55), pan_slide: 1.0/[1,2,4,8].choose,
amp: rrand(0.6,0.8)*rrand(1.0,1.1)
end #flanger
end #pitch_shift
sleep (sample_duration :mySamples__madrid)*grid *(ring 2,2,4,4,1,1,2,2)[tick/2] /4.0
end
end #echo
end #slicer
end #compressor
end #bpm
end #madrid
################################################################
sleep 0.5
################################################################
live_loop :kick do
if bar > 23
with_fx :lpf, cutoff: rrand(110,130), mix: 0.84 do
with_fx :distortion, distort: rrand(0.4,0.7), mix: 0.5 do
sample :bd_haus, amp: rrand(2,2.15) *0.666
end
with_fx :distortion, distort: rrand(0.6,0.8), mix: 0.5 do
sample :bd_pure, amp: rrand(1.6,2.0) *0.666
end
end
end #lpf
sleep 2
if bar > 15
with_fx :echo, phase: 1.0/(ring 6,2,4,2)[tick/2], reps: 2, mix: 0.66 do
with_fx :distortion, distort: rrand(0.6,0.8), mix: 0.7 do
sample :bd_fat, amp: rrand(0.8,0.9)
end #distortion
end #echo
end
sleep 2
end #kick
################################################################
sleep 0.5
################################################################
with_fx :flanger, phase: (ring 32,16,32,4)[tick/64],
wave: (ring 1,2,3,4)[tick/256],
mix: 0.4 do
live_loop :hat do
with_bpm mybpm do
if bar > 47
if rand(100) > 12
16.times do
with_fx :lpf, cutoff: rrand([100,110].choose,120), mix: 0.80 do
use_synth (ring :cnoise,:pnoise,:pnoise,:pnoise)[tick]
play 60, attack: 0.05, release: 0.1, amp: rrand(0.5,0.6)
end #lpf
sleep 0.5
end #32times
end #if rand
end #if bar
sleep 0.5
end #bpm
end #hat
end #flanger
################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment