Skip to content

Instantly share code, notes, and snippets.

@AlexandreRangel
Created July 25, 2016 20:10
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/95433a09e6b2887fb3bb9210f1b4add3 to your computer and use it in GitHub Desktop.
Save AlexandreRangel/95433a09e6b2887fb3bb9210f1b4add3 to your computer and use it in GitHub Desktop.
Sonic Pi music code
# alexandre rANGEL / www.quasecinema.org
# this is not not a siren v14
# Sonic Pi 2.11 / 24-July-2016
set_volume! 0.5; use_bpm 30; set_sched_ahead_time! 2
use_random_seed Time.new.sec * Time.new.min * Time.new.hour
akai = '/Users/rangel/pisamples/akai_note58.aiff'; load_sample akai
# http://www.freesound.org/people/modularsamples/sounds/280911/
siren = '/Users/rangel/pisamples/dubsiren.wav'; load_sample siren
# http://www.freesound.org/people/modularsamples/sounds/280911/
##################################################################
x = 0
y = 2
##| live_loop :midi do
##| with_bpm 120 do
##| k1f = File.read("/Users/rangel/knob1f.txt").to_f
##| k2f = File.read("/Users/rangel/knob2f.txt").to_f
##| k3f = File.read("/Users/rangel/knob3f.txt").to_f
##| k4f = File.read("/Users/rangel/knob4f.txt").to_f
##| k5f = File.read("/Users/rangel/knob5f.txt").to_f
##| k6f = File.read("/Users/rangel/knob6f.txt").to_f
##| k7f = File.read("/Users/rangel/knob7f.txt").to_f
##| k8f = File.read("/Users/rangel/knob8f.txt").to_f
##| sleep 1
##| end
##| end
k1f=k2f=k3f=k4f=k5f=k6f=k7f=k8f=rrand(0.001,1)
live_loop :variables do
k1f=k2f=k3f=k4f=k5f=k6f=k7f=k8f=rrand(0.001,1)
sleep 0.5
end
live_loop :siren1 do
with_fx :slicer, phase: 0.25,
smooth_up: 0.01, smooth_down: [0,0.1,0.2].choose do
if one_in(3)
with_fx :vowel, voice: [1,2].choose, voice_slide: 1,
vowel: [4,5].choose, vowel_slide: 1, mix: rrand(0.2,1.0) do
with_bpm ([1,2].choose * 2) do
4.times do
use_random_seed Time.new.sec * Time.new.min * Time.new.hour
position = (ring 0.1,0.18,0.16,0.22,0.24,0.3,0.32,0.38)[x/8]
with_fx :octaver, mix: rrand(0,1) *k1f do
with_fx :echo, phase: rrand(0.001,0.1), mix: rrand(0.2,0.6)*k2f do
with_fx :pitch_shift, pitch: (ring -5,0,-5,-12,-5,-8)[x/2],
window_size: rrand(0.01,0.2), mix: 0.7 *k3f do
with_fx :slicer, phase: [0.25,0.5,1,1,1,2,2].choose do
with_fx :flanger, phase: [0.5,1,2,4,8,16,32,64].choose,
phase_offset: rrand(0,1),
phase_offset_slide: [0.5,1,2].choose, mix: 0.7 *k4f do
with_fx :echo, phase: [0.05,1,2,4,8,16].choose,
mix: 0.7 *k5f do
with_fx :octaver, mix: rrand(0,0.6) * k6f do
sample siren, start: position, finish: position + 0.1,
amp: rrand(0.5,2.2), amp_slide: [1,2].choose,
pan: rrand(-0.7,0.7), pan_slide: 2, rate: rrand(0.3,0.5)
position = rrand(0,0.799)
sample akai, start: position, finish: position + 0.2,
amp: rrand(2,3.6), amp_slide: [0.2,0.5,1,2].choose,
pan: rrand(-0.7,0.7), pan_slide: 0.5,
attack: [0.25,0.5,1].choose, rate: rrand(-1,1)
end
end
end
end
end
end
end
sleep [1,2].choose
x = x + 1
end
end
end
else
with_fx :vowel, voice: [1,2,1,2].choose, voice_slide: 1,
vowel: [4,5].choose, vowel_slide: 1, mix: rrand(0.2,0.9) do
with_bpm ([2,4,5,10].choose * 2) do
4.times do
use_random_seed Time.new.sec * Time.new.min * Time.new.hour
position = (ring 0.1,0.18,0.16,0.22,0.24,0.3,0.32,0.38)[y/8]
with_fx :octaver, mix: rrand(0,1) do
with_fx :echo, phase: rrand(0.001,0.1), mix: rrand(0.2,0.6) do
with_fx :pitch_shift, pitch: (ring 0,-5,-12,-5,-8)[y/2],
window_size: rrand(0.01,0.1), mix: 0.7 do
with_fx :slicer, phase: [0.25,0.5,1,1,1,2,2].choose do
with_fx :flanger, phase: [0.5,1,2,4,8,16,32,64].choose,
phase_offset: rrand(0,1),
phase_offset_slide: [1,2].choose, mix: 0.7 do
with_fx :echo, phase: [0.05,1,2,4,8,16].choose, mix: 0.7 do
sample siren, start: position, finish: position + 0.1,
amp: rrand(0.7,1.3), amp_slide: [0.5,1,2].choose,
pan: [-1,-0.7,0.7,1].choose, pan_slide: 2,
rate: rrand(0.3,0.5)
position = rrand(0,0.799)
sample akai, start: position, finish: position + 0.2,
amp: rrand(1,2.2), amp_slide: [0.5,1,2].choose,
pan: [-1,1].choose, pan_slide: 0.5,
attack: [0.25,0.5,1].choose, rate: rrand(-1,1)
end
end
end
end
end
end
end
sleep [4,2,2].choose
y = y + 1
end
end
end#if
end
end
##################################################################
sleep 0.25
live_loop :drums1 do
myVolume = rrand(0.333,0.4)
with_bpm 90 / [4,4,3,8,8].choose do
with_fx :slicer, phase: 0.05 do
with_fx :panslicer, phase: [0.1,0.2,0.2,0.5,1].choose, mix: 0.333 do
with_fx :echo, phase: 0.1, mix: 0.8 do
with_fx :krush, res: rrand(0,0.8),
mix: rrand(0.222,0.4444) do
with_fx :reverb, mix: rrand(0.2,0.4) do
with_fx :flanger, phase: 4.0,
depth: [5.0,10.0].choose do
sample :bd_klub, pan: rrand(-0.2,0.2),
amp: 3.3 *myVolume
sleep 0.25
sample :bd_haus, rate: 0.9, pan: rrand(-0.2,0.2),
amp: 3.5
sleep 0.25 *myVolume
sample :bd_haus, pan: rrand(-0.2,0.2),
amp: 3.4 *myVolume
sleep 0.25
2.times do
sample :bd_haus, rate: 1.1, pan: rrand(-0.2,0.2),
amp: 3.3 *myVolume
sleep 1.0/4
sample :bd_haus, rate: 1.1, pan: rrand(-0.6,0.6),
amp: 3.5 *myVolume if one_in(3)
sleep 1.0/4 if one_in(12)
end
end
end
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment