Skip to content

Instantly share code, notes, and snippets.

@jindrichmynarz
Created November 21, 2021 11:33
Show Gist options
  • Save jindrichmynarz/ff5d96bc4b0cfefae429e9879af03062 to your computer and use it in GitHub Desktop.
Save jindrichmynarz/ff5d96bc4b0cfefae429e9879af03062 to your computer and use it in GitHub Desktop.
Live coding noise in Sonic Pi
use_debug false
instruments = 1
drums = 1
live_loop :clock do
sleep 1
end
noise_cutoffs = range(100, 120, 0.1).reflect
live_loop :noises, sync: :clock do
if spread(3, 8).tick then
with_fx :echo, phase: 0.25, mix: 0.3 do
with_fx :hpf, cutoff: noise_cutoffs.look do
synth :noise, decay: 0.1, release: 0.1, pan: -0.5, amp: drums
end
end
end
sleep 0.25
end
fadein = ramp(*range(0, 1, 0.01))
bass_depths = range(3, 4, 0.1).reflect
live_loop :bass, sync: :clock do
if spread(5, 8).tick then
synth :fm, note: :e1, release: 0.1, decay: 0.2, divisor: 0.5,
depth: bass_depths.look, amp: 0.4 * instruments * fadein.look
end
sleep 0.25
end
live_loop :hats, sync: :clock do
if spread(3, 4).tick then
with_fx :rhpf, cutoff: 120, res: 0.7 do
synth :pnoise, decay: 0.1, release: 0.05, pan: 0.5, amp: drums
end
end
sleep 0.25
end
crash_cutoffs = range(80, 120, 2).reflect
crash_rooms = range(0.4, 0.9, 0.05).reflect
live_loop :crash, sync: :clock do
sleep 2
with_fx :reverb, mix: 0.4, room: crash_rooms.look do
synth :cnoise, decay: 0.3, release: 0.1, cutoff: crash_cutoffs.tick, amp: drums
end
sleep 2
end
live_loop :boom, sync: :clock do
with_fx :compressor, pre_amp: 16 do
sample :bd_boom, amp: drums
end
sleep 4
end
bits = range(4, 8).reflect
sample_rates = range(2000, 8000, 100).reflect
live_loop :synth, sync: :clock do
with_fx :slicer, phase: 1.5 do
with_fx :bitcrusher, bits: bits.tick, sample_rate: sample_rates.look do
synth :sine, note: chord(:e3, [:sus2, :sus4].look, num_octaves: rrand_i(3, 4)),
attack: 8, amp: 0.5 * instruments
end
end
sleep 8
end
octaves = stretch([2, 4], 8)
cutoffs = range(80, 120, 0.5).reflect
live_loop :saws, sync: :clock do
with_fx :echo, mix: 0.4, feedback: 0.4, phase: 0.75, decay: 8 do
synth :saw, note: chord(:e3, :minor, num_octaves: octaves.tick), decay: 0.1,
release: 0.1, cutoff: cutoffs.look, amp: 0.5 * instruments
end
sleep 4
end
@GodrichBeaulieu
Copy link

beautiful

@edelveart
Copy link

Good material. It is interesting to know that in (range a, b, c), c is the step size and Sonic Pi interprets it as such. However, it does not include 5 if we write (range 2, 5, 0.25, true), where true is the inclusive option,
We must necessarily place (range 2, 5, step: 0.25, inclusive: true).

Greetings!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment