Skip to content

Instantly share code, notes, and snippets.

@kniknoo
Last active Feb 3, 2021
Embed
What would you like to do?
Rubber Dub for Sonic Pi
# Rubber Dub
# Coded by KniKnoo
use_bpm 75
use_debug false
use_random_seed 98736
define :sn_roll do #|length|
in_thread do
sn_amp = 0.05
4.times do
sample :sn_dolf, amp: sn_amp, sustain: 0, release: 0.125
sleep 0.0625
sn_amp += 0.07
end
end
end
live_loop :bass do
with_fx :compressor, slope_above: 0.85, threshold: 0.3, amp: 0.7 do
sync :bass
6.times do
nlen = [0.25, 0.25, 0.5, 0.5, 0.75, 1].choose
with_fx :wobble, phase: (ring, 0.75, 1, 1.5).choose , wave: 3, smooth: 0.05, cutoff_min: 50, cutoff_max: 85, res: 0.4, invert_wave: 1, reps: 2 do
synth :subpulse, note: (scale, :g1, :minor_pentatonic).choose, amp: 0.65, release: nlen, sub_detune: 0
sleep nlen
end
end
sleep 2
end
end
live_loop :kick do
sample :drum_heavy_kick
sleep 1
end
with_fx :reverb, mix: 0.35, room: 0.1, damp: 0.9 do
live_loop :snare do
use_sample_defaults sustain: 0, release: 0.25
sleep 0.75
sn_roll if rand > 0.8
sleep 0.25
sample :sn_dolf
del = [0.25, 0.5, 0.75].choose
cue :bass
sleep del
sample :drum_snare_soft, amp: 0.7 if rand > 0.5
sleep 1 - del
end
end
live_loop :hats do
sample :drum_cymbal_closed, sustain: 0.125, amp: 0.3 if rand > 0.9
sleep 0.5
sample :drum_cymbal_closed, sustain: 0.125, amp: 0.5
sleep 0.5
end
live_loop :hats2 do
sample [:elec_tick, :elec_blip].choose, sustain: 0.006, amp: 0.8, hpf: 100 if rand > 0.3
sleep 0.25
end
with_fx :gverb, mix: 0.1, room: 20, amp: 0.6 do
live_loop :skank do
with_fx :bitcrusher, mix: 0.7, amp: 0.5, bits: 8, sample_rate: 3136 do
use_synth :dpulse
use_synth_defaults release: 0.125
sleep 0.5
if rand > 0.8
with_fx :echo, phase: [0.25, 0.333, 0.375, 0.75].choose, decay: 4, mix: 0.5 do
play (chord, :g4, :m, invert: -1)
end
else
play (chord, :g4, :m, invert: -1)
end
3.times do
sleep 1
play (chord, :g4, :m, invert: -1)
end
sleep 0.5
end
end
end
with_fx :echo, mix: 0.8, phase: 0.75, decay: 4 do
live_loop :lead do
with_fx :flanger, stereo_invert_wave: 1, feedback: 0.5, amp: 0.5 do
sync :bass
sync :bass
use_synth :mod_beep
rps = (range 6, 9).choose
use_synth_defaults res: 0.9, attack: 0.25, noise: 2, release: 2 , cutoff: 100, amp: 0.2,
note_slide: 0.02, sustain: 0.25 * rps / 1.25, decay: 0.25 * rps / 1.25, sustain_level: 0.8,
mod_range: 0.5, mod_phase: 0.125, mod_wave: 2, pulse_width: 0.2
mynote = (note_range, :g4, :g6, pitches: (scale, :g, :minor_pentatonic))
play mynote.reverse.tick
rps.times do
control note: mynote.tick - [0, 12].choose
sleep [0.25, 0.25, 0.5, 0.5, 0.75].choose
end
sleep 2.5
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment