Skip to content

Instantly share code, notes, and snippets.

@beryann
Created April 24, 2024 09:41
Show Gist options
  • Save beryann/8c9775d10ebb7563a9d000dd19258a46 to your computer and use it in GitHub Desktop.
Save beryann/8c9775d10ebb7563a9d000dd19258a46 to your computer and use it in GitHub Desktop.
A 4 voices fugato with decrescendo
use_bpm 100
set :kill,false #flag used to stop live_loops
fadeInitiate = rt(30) #use rt( ) function to set time independent of bpm
fadeTime = rt(30)
use_debug false #remove printout of synths playing
cells = [
[2],
[1,1],
[1,0.5,0.5],
[0.5,0.5,1],
[0.5,0.5,0.5,0.5],
[0.75,0.25, 0.75,0.25],
[0.25,0.25, 0.25,0.25, 0.25,0.25,0.25,0.25],
[1, 0.25,0.25,0.25,0.25],
[0.25,0.75, 0.25,0.75],
[0.5,1,0.5],
[1.5,0.5],
[0.5,1.5]
]
with_fx :reverb do
with_fx :level,amp: 1 do|v| #use fx level to control fade out
at fadeInitiate do #at specified time control fade out via pointer v
puts "Fadeout started"
control v,amp: 0,amp_slide: fadeTime
sleep fadeTime
puts "Fade complete: stopping live loops"
set :kill,true #set kill flag which will stop the live loops
end
live_loop :rythm do
##| stop
use_synth :pluck
n = rand_i(cells.length)
#puts n
cells[n].length.times do
stop if get(:kill)
play scale(:d4,:major).choose,release: cells[n].tick
sleep cells[n].look
end
end
live_loop :rythm2, delay: 8 do
##| stop
use_synth :bass_foundation
n = rand_i(cells.length)
#puts n
cells[n].length.times do
stop if get(:kill)
play scale(:d4,:major).choose,release: cells[n].tick, cutoff: rrand(40,120), amp: 0.5, pan: rrand(-1.0,1.0)
sleep cells[n].look
end
end
live_loop :rythm3, delay: 16 do
##| stop
use_synth :bass_foundation
n = rand_i(cells.length)
#puts n
cells[n].length.times do
stop if get(:kill)
play scale(:d4,:major).choose,release: cells[n].tick, cutoff: rrand(40,120), amp: 0.5, pitch: -12
sleep cells[n].look
end
end
live_loop :rythm4, delay: 24 do
##| stop
use_synth :piano
n = rand_i(cells.length)
#puts n
cells[n].length.times do
stop if get(:kill)
play scale(:d4,:major).choose,release: cells[n].tick, amp: 0.5, pitch: -24, amp: 1
sleep cells[n].look
end
end
end#level
end#reverb
@beryann
Copy link
Author

beryann commented Apr 24, 2024

Made with Sonic Pi!

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