Wow. I love Sonic Pi. Been goofing with it on and off since I bought my first RPi. Big ups to Sam Aaron and the whole Sonic Pi community. It’s a miraculous piece of software and free. We live in a golden age. Thanks in advance to anyone who is reading this.
A recent issue has me so twisted, I had to join the community and post about it.
I’m learning to use live_audio and fx. Specifically, I’m working on using :record as a looping pedal for a guitar input. But my results are inconsistent. I’m beginning to think that the buffering is buggy on my machine/OS (details below). But I’m able to trip it up every time by using the “use_bpm” function.
If I run the code without use_bpm, the song will take off at 60 bpm and, 99% of the time, it will capture the loop and play it back to me. HOWEVER, if I add the use_bpm function and put in certain values, the :record fx fails to capture.
When it fails, the log shows that it is triggering the buffer for playback, but there is no audio.
Certain BPM’s will capture. Others will not.
Good BPM’s
-100, 90, 120, 112, 160
Bad BPM’s
- 110,101,99,113 thru 119, 121, 130
I have been testing this for about 48 hours. Good BPM’s will reliably work. And bad BPM’s will reliably NOT work. WHY?!?!
Obviously, I haven’t tested every BPM. But in all my testing, I can’t see a pattern, beyond the fact that BPM’s that are multiples of 10 are more likely to work.
Here are the details about my setup
Hardware:
MacBook Pro
2.3 GHz Intel Processor
OSX 12.6 Monterey
Focusrite soundcard Scarlett 414
Sonic Pi 4.3.0
Code:
use_bpm 112
live_loop:drums do
sample :bd_haus, cutoff: 70
sleep 1
end
with_fx :reverb do
with_fx :echo, phase: 0.74, decay: 4 do
with_fx :record, buffer: buffer(:bname2, 8) do
live_audio :foo
end
end
end
live_loop :guitar2 do
sample buffer[:bname2]
sleep 8
end