Skip to content

Instantly share code, notes, and snippets.

@jprudent
Created February 19, 2022 18:21
Show Gist options
  • Save jprudent/02b849de7b9d1a416ed1cf4aa4c46a00 to your computer and use it in GitHub Desktop.
Save jprudent/02b849de7b9d1a416ed1cf4aa4c46a00 to your computer and use it in GitHub Desktop.
Sonic Pi - Dub
use_bpm 128
tpb = 60 / 128.0
chord_trigg = [0, 0,1,0]
kick_trigg = [1, 0,0,0]
snare_trigg = [1, 0 ,0,0]
bass_trigg = [0,1, 0 ,1]
ks = [:kick, :snare]
define :orchestrator do
cue ks.tick(:ks) if kick_trigg.tick(:kick) > 0
cue :arp if not one_in(4)
cue :chords if chord_trigg.tick(:chords) > 0
cue :bass if bass_trigg.tick(:bass) > 0
sleep tpb
sleep tpb if one_in(30)
end
define :bass do
sync :bass
use_synth :subpulse
play choose([:e2, :e2 + 7]), sustain: tpb*1.5, amp: 1, cutoff: 40
end
define :arp do
sync :arp
use_synth :tb303
note = choose(chord(:e2, :minor))
play note, release: 1, cutoff: rrand(60, 70)
#play note+0.1, release: 1, cutoff: rrand(60, 70)
with_fx :slicer, phase: 0.5 do
sleep tpb / 2
note2 = note+choose([12, 24, 12, 24, 12+7, 24-5])
cutoff2 = rrand(110, 130)
play note2, release: 1, cutoff: cutoff2
sleep 0.1
#play (note2 - 5), attack: 0.5
end
end
define :chords do
sync :chords
use_synth :piano
sleep rand(0.1)
play chord([:e3, :e4, :e5, :e5, :e4].tick(:chord_n), :minor), cutoff: 100, amp: 1
end
define :snare do
sync :snare
room = 0.5
room = 1 if one_in(2)
sample :bd_808, amp: 1
with_fx :reverb, room: room do
sample :sn_zome, amp: 1
end
end
define :kick do
sync :kick
sample :bd_808, amp: 7
with_fx :reverb, room: 1 do
sample :bd_pure, amp: 3
end
end
in_thread(name: :bass) do
loop do
bass
end
end
in_thread(name: :snare) do
loop do
snare
end
end
in_thread(name: :kick) do
loop do
kick
end
end
in_thread(name: :chords) do
loop do
chords
end
end
in_thread(name: :arp) do
loop do
arp
end
end
in_thread(name: :orchestrator) do
loop do
orchestrator
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment