Skip to content

Instantly share code, notes, and snippets.

@AlexandreRangel
Last active June 10, 2017 03:38
Show Gist options
  • Save AlexandreRangel/71b087c5c8a4ecb2bc2e to your computer and use it in GitHub Desktop.
Save AlexandreRangel/71b087c5c8a4ecb2bc2e to your computer and use it in GitHub Desktop.
Sonic Pi music code
# Alexandre rANGEL - www.quasecinema.org
# church-of-men-of-love (v08)
# feeling weird about phisicality
# 30-Jan-2016
# Sonic Pi 2.12
#use_bpm 96 # for intro
use_bpm 136
startClock = 0 # 0 to start song at beginning
clock = 0 # global var
bar = 0 # global var
set_volume! 0.85
t = Time.new
use_random_seed = 4 #(t.year + t.month + t.day + t.hour + t.min + t.sec)
# download sample, rename to metal.wav and put in your samples folder
# http://www.freesound.org/people/vmgraw/sounds/235615/
sampleMetal = '/Users/rangel/Documents/SamplesPi/metal.wav' # your path here
load_sample sampleMetal
#############################################################
# use_synth :beep # countdown sync
# play 90, attack: 0, sustain: 1, release: 0, amp: 2
# sleep 2
# play 90, attack: 0, sustain: 1, release: 0, amp: 2
# sleep 2
# play 90, attack: 0, sustain: 1, release: 0, amp: 2
# sleep 4
#############################################################
live_loop :metro do
cue :metro
sleep 0.5
clock = startClock + tick
bar = clock / 4
puts "bar : #{bar}"
puts (ring "1 |","2 | |","3 | | |","4 | | | |")[clock]
end #metro
#############################################################
with_fx :compressor, pre_amp: 1.00, threshold: 0.5,
slope_below: 1.2, slope_above: 0.77, mix: 0.7 do
#############################################################
live_loop :ambienceBeat do
sample sampleMetal, beat_stretch: 36,
start: 0.38, pitch: -0.2,
window_size: rrand(0.0001,0.01),
attack: 0.5, release: 3.5, amp: 4
sleep 18/2
end # :ambienceBeat
sleep (16)-2 if bar < 16 # delay start if intro
#############################################################
live_loop :synth1 do
sync :metro
with_fx :pitch_shift, window_size: rrand(0.01,0.05),
pitch: (([-12,-8,-4,0,4,8,12,16].choose)-8) do
with_fx :slicer, phase: (ring 1,0.75,0.5,0.2,0.1)[tick/32],
mix: (ring 0,0.2,1,0.5,0,1)[tick/8] do
for i in 1..4
with_fx :slicer, phase: (0.25 * i) do
sample [:bass_voxy_c,:bass_trance_c].choose,
rate: (0.1*i),
attack: (ring 0,0.4,0,0.8)[tick], amp: 2
sample :bass_voxy_c, rate: -(0.1*i),
attack: (ring 0,0.4,0,0.8)[tick], amp: 2
sleep 4 * i
end #slicer
end #for
end #slicer
end #pitch
sleep 4
end # :synth1
sleep 4 #delay start
sleep 36 / 3 #delay start
#############################################################
live_loop :bass do
sync :metro
use_synth (ring :tb303,:pulse,:prophet)[tick/32]
with_fx :ixi_techno, res: (ring 0.2,0.6,0.8)[tick/2],
mix: (ring 0,0.5,1,1)[tick/2] do
with_fx :echo, phase: (ring 2.5,0.25,2.5,0.5,1.5)[tick/16] do
play chord(:c2, :minor7 ).choose, amp: 0.6 *1.2, attack: 0.1,
release: (ring 0.2,0.4,0.1,0.8)[tick/32]
end #echo
end # :ixi_techno
sleep [0.5,1,1,2].choose
end # :bass
sleep 8 #delay start
#############################################################
live_loop :hat do
sync :metro
use_synth [:cnoise,:cnoise,:pnoise,:noise].choose
play 60, release: (ring 2,2,2,0.6,2,2,2,0.8)[tick],
amp: (ring 0.07,0.09)[tick]
if one_in(12)
sleep 1
else
sleep 2
end #if
end # :hat
#############################################################
#sleep 1
sleep 2 #offbeat from hat
#############################################################
live_loop :kick do
sync :metro
sleep 0.5
with_fx :ixi_techno, res: (ring 0.2,0.6,0.8)[tick/2] do
8.times do
sample :bd_klub, rate: (ring 0.9,0.8,0.9,0.7)[tick/2],
amp: 4 *1.05
sleep 2
end
128.times do
sample :bd_klub, rate: (ring 0.9,0.8,0.9,0.7)[tick/2],
amp: 3.5 *1.05
sample :bd_haus, rate: (ring 0.9,0.8,0.9,0.7)[tick/4],
amp: rrand(0.4,0.5) *rrand(1.03,1.08)
sleep 1
end
end # :ixi_techno
sleep 8
end # :kick
#############################################################
end #compressor
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment