"Looper pedal" effect using record fx attenuates over time

Hi, I’m trying to add a looper-pedal like setup in my Sonic-Pi. Here’s my naive code:

b = buffer(:looperbuf, 4)
live_loop :looper do
  with_fx :record, buffer: b do
    sample b
    live_audio :qsynth, input: 3, stereo: true
    sleep 4
  end
end 

Since I’m leaving all of the mix, pre_amp and amp settings to their default I’d expect the buffer to be re-recoded identically on each loop, mixing in the live_audio if any. But this doesn’t appear to be the case: on my current build of 3.2 this behaves more like an echo effect, repeating the audio after a delay of 4 but fading over time. I can try to adjust amp on the sample but that isn’t very satisfying. It seems that amp: 1.4 is close to keeping the signal at the same level over time, but I’m not sure how well it would hold over a long period of time.

Is there an easier way to have a similar setup that does not attenuate over time? Maybe some parameter I overlooked? Thanks!

I have a slightly different construction running. Based on my experience, if you feed back the recorded signal into the recording buffer with a pre_amp of 1.45 the volume seems to stay steady. But… I did not check this for more than a minute (as I did implement this in my Live Looper just an effect and focused mainly on the more or less slowly attenuating loop sound). Nevertheless you can experiment with different values.

1 Like

I saw your live looper and it’s really cool, very complete :slight_smile: I wanted something that felt more like I was live-coding it without loading too much library stuff, so minimalism was a feature for me. With this I can easily live-code it from scratch and with little risk of errors. It’s a bit more work to switch between record/play, as I move the live_audio line in and out of the with_fx :record block manually (or I have a pair and one is commented, the other uncommented). To clear the buffer I just eval a buffer(:looperbuf, 0.1) statement anywhere.

1.4 turned out to be too low over long runs (>10min). 1.5 is too high. 1.45 has worked so far, thanks for the tip.

I’m still curious why it’s needed to tweak the amp though: I’d expect that sample with amp: 1 and with_fx :record, pre_amp:1 should not attenuate anything. The changelog even suggests it’s an intended use: New FX record - enables you to internally record any audio into named buffers. Perfect for building looper systems.

Hi @korfuri,

yes, I do understand, what you mean. Actually I think the same but we do draw the line elsewhere: For me it is especially about playing with other musicians (or maybe input from the audience), recording bits of what they do. I did not want to code the means to do so, butto concentrate on manipulating the recorded input and create addtional stuff. So this was the perfect use case for some external control (either some Midi controller, a Monome (which I do not own yet), or TouchOSC).

My experience with live coding so far is, that you have to be very efficient (or you have loads of patience and moreover your audience too). So I collect ways to create efficient strategies which includes a decision about what to code and what to prepare in advance.

Yeah, that is somehow strange and I think I remember that I was asking myself the same question when I began writing the Live Looper.