Skip to content

Instantly share code, notes, and snippets.

@mbutz
Created November 9, 2021 17:40
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 mbutz/773f0b7fed1ce9b4b20b1da13dc5686c to your computer and use it in GitHub Desktop.
Save mbutz/773f0b7fed1ce9b4b20b1da13dc5686c to your computer and use it in GitHub Desktop.
Field (Sonic Pi)
# Field
#
# filename: field.rb
# carla: field.carxp
use_bpm 120
live_loop :beat do
sleep 8
end
live_loop :kick, sync: :beat do
#stop
cnt = tick % 4
with_fx :sound_out_stereo, output: 3 do
sample :bd_ada, amp: 1, rate: 1.25
at [0.75] do
sample :bd_ada, amp: 0.75, rate: 0.95 if cnt == 3
end
end
sleep 1
end
live_loop :bass, sync: :beat do
#stop
n = (ring :c2, 2.5, :g2, 0.5, :c3, 0.5, :bb2, 2, :f2, 2.5) + (ring :c2, 3.5, :g2, 0.5, :c3, 0.5, :bb2, 1, :a2, 1, :g2, 0.5, :r, 0.5, :f2, 0.5)
n = (ring :c2, 2.5, :c2, 0.5, :bb2, 0.5, :r, 2, :r, 2.5) + (ring :c2, 3.5, :c2, 0.5, :r, 0.5, :r, 1, :r, 1, :r, 0.5, :r, 0.5, :c2, 0.5)
use_synth :fm
use_synth_defaults depth: 1, divisor: 1, cutoff: 50, attack_level: 2, amp: 1
with_fx :sound_out_stereo, output: 3 do
play n.tick, release: n.tick
end
sleep n.look
end
live_loop :buchla, sync: :beat do
#stop
ptn = (ring 0,0.25,0,0.5, 0,0,0.5,0.75, 0,1,0.25,0, 0,0.25,0.75,0)
with_fx :sound_out_stereo, output: 9 do
sample samples + "buchla", [1, 2, 13].choose, rate: 2.4, finish: (ring 0.0055, 0.0075, 0.025, 1).choose, pan: rrand(-0.25, 0.75), amp: ptn.tick * 1
end
sleep 0.25
end
live_loop :loopi, sync: :beat do
#stop
with_fx :sound_out_stereo, output: 7 do # out 9 (hassell), 7
with_fx :slicer, smooth: 0.25, amp: 1 do
3.times do
sample lcc, 12, beat_stretch: 8, finish: 0.5, attack: 1, rpitch: 13.5, hpf: 50, amp: 1.25
sample lcc, 12, beat_stretch: 8, finish: 0.5, rpitch: 1.5, hpf: 50
sample lcc, 12, beat_stretch: 8, finish: 0.5, attack: 1, rpitch: 1.5 - 7, hpf: 70
sleep 4
end
sample lcc, 12, beat_stretch: 8, start: 0.5, rpitch: 13.5, hpf: 50, amp: 1.25
sample lcc, 12, beat_stretch: 8, start: 0.5, rpitch: 1.5, hpf: 50
sample lcc, 12, beat_stretch: 8, finish: 0.5, attack: 1, rpitch: 1.5 - 5, hpf: 70
sleep 4
end
end
end
live_loop :drums, sync: :beat do
#stop
with_fx :sound_out_stereo, output: 3 do
with_fx :rhpf, res: 0.75, mix: 1, cutoff: 80 do
3.times do
sample jungle, 93, beat_stretch: 8
sleep 8
end
sample jungle, 93, beat_stretch: 8, finish: 0.5 + (ring 0.125, 0, 0).choose
sleep 5
6.times do
sample jungle, 93, beat_stretch: 8, num_slices: 16, slice: (ring 0, 2, 6, 8, 10, 12, 14).choose
sleep 0.5
end
end
end
end
live_loop :sphere, sync: :beat do
stop
notes = [(ring :c4, :f4, :bb4, :c5),
(ring :c4, :c4, :f4, :f5),
(ring :c4, :f4, :c3, :c5),
(ring :c4, :bb5, :bb4, :c4)
]
with_fx :sound_out_stereo, output: 5 do
with_fx :rhpf, cutoff: 110, res: 0.5, amp: 0.25 do |rhp|
control rhp, cutoff: 40, cutoff_slide: 32,
amp: 0.75, amp_slide: 32,
res: 0.9, res_slide: 20
with_transpose (ring 0, 5, 12).choose do
with_fx :slicer, mix: 0.5 do
with_fx :slicer, phase: [0.75, 1.25].choose, mix: 0.5 do
with_fx :panslicer, phase: [0.5, 0.75, 1.25].choose, pan_max: -0.75, pan_min: 0.8 do
s = synth :dsaw, note: notes.choose, release: 36
control s, note: notes.choose, note_slide: 12 if one_in 2
end
end
end
end
end
end
sleep (ring 32, 64, 96).choose
end
live_loop :overtone, sync: :beat do
#stop
n = (chord [:c2, :f2, :bb2].choose, [:sus4, :sus2].choose, invert: [-1, 0, 1, 2].choose, num_octaves: 4)
with_fx :sound_out_stereo, output: 5 do
with_fx :rhpf, res: 0.5, cutoff: 30 do |rhp|
with_fx :slicer, smooth: 0.5 do
with_fx :panslicer, phase: [0.25, 0.5, 0.75].choose do
s = synth :dsaw, note: n, sustain: 64, cutoff: 80, amp: 0.0
control s, amp: 0.5, amp_slide: 128
control rhp, res: 0.9, res_slide: 16, cutoff: 90, cutoff_slide: 32
sleep 32
control s, amp: 0.0, amp_slide: 24
control rhp, res: 0.65, res_slide: 16, cutoff: 50, cutoff_slide: 16
end
end
end
end
# sleep 8
sleep (ring 16, 32).choose
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment