Skip to content

Instantly share code, notes, and snippets.

@AlexandreRangel
Last active January 5, 2016 00:41
Show Gist options
  • Save AlexandreRangel/baba435a6cec9165a094 to your computer and use it in GitHub Desktop.
Save AlexandreRangel/baba435a6cec9165a094 to your computer and use it in GitHub Desktop.
Sonic Pi music code
# Alexandre rANGEL / www.quasecinema.org
# passion-v04
# Sonic Pi 2.9 / 4-Jan-2016
use_bpm 140 / 12
clock = 0
set_volume! 2.75
t = Time.new
tx = (t.year / t.month / t.day / (t.hour+1) * t.min * t.sec)
use_random_seed tx
puts tx #7182
#############################################################
# countdown sync
# use_synth :beep
# play 90, attack: 0, sustain: 1.0 /8, release: 0, amp: 0.75
# sleep 2.0 / 8
# play 90, attack: 0, sustain: 1.0 /8, release: 0, amp: 0.75
# sleep 3.0 / 8
##############################
live_loop :metro do
cue :metro
sleep 0.5
#clock = tick
#puts clock
end #metro
with_fx :compressor, threshold: 0.1, relax_time: 0.05,
pre_amp: 0.1, mix: 0.75 do
##############################
live_loop :pim do
with_fx :pitch_shift, pitch: (ring 0,-8,-4)[tick/16],
window_size: [0.001,0.005,0.008,0.001].choose do
sample :ambi_glass_rub, start: (ring 0.5,0.5,0.5,0.7,0.5,0.5,0.5,0.1)[tick],
attack: 0.025,
pan: rrand(-0.9,0.9), pan_slide: 1.0 / rrand(3.1,4.9),
amp: rrand(0.5,0.85) * 25
end #fx
sleep 1.0 / 2
end
##############################
live_loop :tut do
with_fx :pitch_shift, pitch: (ring 0,-2,-4)[tick/16],
window_size: [0.001,0.005,0.008,0.001,0.01].choose, mix: 0.25 do
with_fx :distortion, distort: (ring 0.5,0.4,0.5,0.2)[tick], mix: rrand(0.2,0.9) do
sample :bass_dnb_f, start: (ring 0.5,0.5,0.5,0.8,0.5,0.7,0.5,0.1)[tick],
pan: rrand(-0.9,0.9), pan_slide: 0.1,
rate: [0.05,0.1,0.2,0.3,0.4,0.6,0.8,1.0,0.6,0.8,0.8,0.8,0.9,1.0,1.0,0.8,1.0].choose,
amp: 0.75 * 25.0
end #fx
end #fx
sleep 1.0 / 4
end
##############################
sleep 2
##############################
live_loop :ts do
use_synth (ring :pnoise,:pnoise,:pnoise,:cnoise)[tick]
play 60, attack: 0.01, release: 0.01,
pan: rrand(-1,1), rate: rrand(0.85,1.1),
amp: rrand(0.666,0.9) * [3,3,4,5,5,5].choose
sleep 1.0 / 64
if one_in(720) then
sleep 1
end
end
##############################
end # compressor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment