Skip to content

Instantly share code, notes, and snippets.

@nicoder
Created December 19, 2021 07:57
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 nicoder/50a858114ed36471e49c4bbeb0e48237 to your computer and use it in GitHub Desktop.
Save nicoder/50a858114ed36471e49c4bbeb0e48237 to your computer and use it in GitHub Desktop.
# adapted from robin newman:
# https://in-thread.sonic-pi.net/t/record-vocal-and-playback-with-effects/6202/5
use_bpm 60
use_real_time
i = 0
buffers = []
duration = 8
4.times do
play 84, release: 0.2, amp: 0.3
sleep 1
end
live_loop :a do
puts "record";play 84,release: 0.2, amp: 0.3
b = buffers[i] = buffer('buff' + i.to_s, 8)
puts "buffer beats #{b.duration}"
with_fx :record, buffer: b do
with_fx :level, amp: 2 do
live_audio :mic
sleep b.duration
#sleep rt(5)
end
end
i = i + 1
end
live_loop :b do
#sync :a
with_fx :reverb, room: 0.8 do #apply some reverb as an example
buffers.each do |b|
sample b, rate: 1
end
sleep duration
end
puts "ended"
puts "wait"
# sleep rt(5)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment