Skip to content

Instantly share code, notes, and snippets.

@unforswearing
Last active April 19, 2025 16:55
Show Gist options
  • Save unforswearing/12c66f43c2616c5a6100d2dfb9b17a98 to your computer and use it in GitHub Desktop.
Save unforswearing/12c66f43c2616c5a6100d2dfb9b17a98 to your computer and use it in GitHub Desktop.
Paper Tether - Untitled (for SonicPi)
define :reset_when_greater do |time, limit|
if time > (2 / limit)
newtime = time * 1.25
elsif time > limit
newtime = time / 2.5
else
newtime = time / 1.01
end
if newtime > 50
newtime = newtime / 2.12
end
puts newtime
return newtime
end
define :melody do
use_synth :sine
use_synth_defaults amp: 0.25, attack: 1, sustain: 0.75, decay: 0.75, release: 0.75
notes = [
(ring :F, :F, :F, :F, :C, :C, :F, :C),
(ring :F, :F, :C, :F, :C, :F, :F, :F),
(ring :C, :C, :C, :C, :F, :C, :C, :F),
(ring :F, :F, :C, :F, :F, :C, :F, :F),
(ring :G, :C, :C, :C, :F, :C, :F, :F, :F)
]
notes.each do |note_ring|
note_ring.each do |n|
puts n
tick
with_fx :reverb, room: 1, pre_mix: 0.5 do
play note(n, octave: 4)
with_fx :slicer, mix: rrand(0.3, 0.65), amp: 0.5, phase: rrand(0.25, 0.75), probability: rrand(0.125, 0.65) do
play note(n, octave: 5)
end
play note(n, octave: 4)
with_fx :echo, phase: 1.25, decay: rrand(0.25, 2), _slide: 7 do
play note(n-1, octave: rrand_i(2, 5))
play note(n+2, octave: 3)
end
sleep rrand(rrand(0.5,1), reset_when_greater((0.63 + (tick)), 10))
end
end
end
end
define :base do
use_synth :sine
use_synth_defaults amp: 0.25, attack: 0.75, sustain: 0.75, decay: 0.75, release: 0.75
notes = [
(ring :F, :F, :C, :F, :F, :C),
(ring :F, :F, :F, :F, :C, :C, :F, :F, :C, :F),
(ring :G, :F, :F, :C, :C, :C, :F),
(ring :G, :F, :F, :F, :F, :C, :C, :C),
(ring :C, :F, :C, :C, :G, :F, :F, :F, :F)
]
notes.each do |note_ring|
note_ring.each do |n|
puts n
tick
with_fx :reverb, room: 1, pre_mix: 0.5 do
play note(n, octave: 4)
time_warp rrand(-1, 1) do
with_fx :reverb, room: rrand(0.1, 1), damp: 1, mix: 0.7 do
play note(n, octave: rrand_i(2, 5))
end
end
play note(n, octave: 4)
3.times do
with_fx :reverb, room: rrand(0.1, 1), damp: 1, mix: 0.7 do
play note(n, octave: 4)
end
end
play note(n, octave: 2)
sleep rrand(rrand(0.5, 2.125), reset_when_greater(((tick / 0.63) - tick), 20))
end
end
end
end
define :fill do
use_synth :sine
use_synth_defaults amp: 0.25, attack: 0.75, sustain: 0.75, decay: 0.75, release: 0.75
notes = [
(ring :F, :F, :C, :F, :F, :C),
(ring :F, :F, :F, :F, :C, :C, :F, :F, :C, :F)
]
notes.each do |note_ring|
note_ring.each do |n|
puts n
tick
time_warp rrand(-1, 1) do
with_fx :echo, phase: 1, mix: 0.25, decay: rrand_i(2, 20) do
play note(n, octave: rrand_i(2, 5))
end
end
5.times do
with_fx :reverb, room: rrand(0.4, 1), damp: rrand(0.2, 0.9), mix: rrand(0.6, 1) do
play note(n, octave: 4)
end
end
sleep rrand(rrand(0.25, 1.125), reset_when_greater(tick, 20))
end
end
end
with_fx :reverb, room: 0.80, pre_mix: 1 do
in_thread do
with_fx :echo, phase: rrand(0.5, 1.5), decay: rrand(1, 40), _slide: 10 do
with_fx :ring_mod, mix: rrand(0.125, 0.5), freq: rrand(261, 440) do
melody
end
end
end
sleep 11.48
in_thread do
with_fx :echo, phase: rrand(0.25, 2), decay: rrand(5, 30) do
with_fx :ring_mod, mix: rrand(0.125, 0.25), freq: rrand(522, 880) do
base
end
end
end
sleep 18.36
in_thread do
with_fx :echo, phase: rrand(0.125, 1.5), decay: rrand(0.5, 12) do
with_fx :ring_mod, mix: rrand(0.25, 0.75), freq: rrand(261, 440) do
melody
end
end
end
sleep 67.5
1.times do
with_fx :echo, phase: rrand(0.125, 0.75), decay: rrand(0.5, 5) do
with_fx :ring_mod, mix: rrand(0.25, 0.75), freq: rrand(100, 900) do
fill
end
end
sleep 136
with_fx :echo, phase: rrand(0.25, 0.75), decay: rrand(1, 15) do
with_fx :ring_mod, mix: rrand(0.25, 0.75), freq: 349 do
fill
end
end
end
play :F
end

Comments are disabled for this gist.