Buffer~ latency

Nov 20, 2011 at 10:52pm

Buffer~ latency

Hi guys,

I have started making a patch that uses live buffers. The essence of it is that you record (using record~ and buffer~) a 1 bar loop with a microphone (Beardy man esk) which repeats itself once it gets to the start of a bar again. My problem is that there is an audible latency when doing so… My question is, is the latency between the buffer~ and the play~ objects or is this my soundcard? How would I go about testing this? and what (if any) would be a viable solution or work-around?

I would be really greatful if someone could answer my questions because it’s driving me crazy!! I have posted my patch underneath for context :)

cheers, Lucas

– Pasted Max Patch, click to expand. –
Nov 20, 2011 at 11:56pm

Buffer doesn’t “do” anything but hold the sample so there’s no ‘latency’ between that and a playback object.
What’s your I/O Vector size set to? (the lower the number, the lower your latency will be)

That’s a doozy of a patch. It’s usually a good idea to post a trimmed up version of your patch that illustrates the exact problem as it’s unlikely someone will try to make sense of you’re whole patch to help you troubleshoot it.

I found that for my purposes using poke (as the record object) and groove (as the play object) is super flexible as you can do overdubbing while playing back (into the same buffer) etc..

Here’s a looper built using those objects:

– Pasted Max Patch, click to expand. –
Nov 21, 2011 at 1:53am

Cheers Rodrigo,

yeah sorry, i should have cut it down a little.. thanks for showing me your patch, it’s given me some new inspiration!

I thought it might have been the I/O vector size but its stuck at 528 for me so I couldn’t change it if i wanted to :/ i didnt think that this was the problem though because when i am in the studio at university we set the DAWs up to record with an I/O buffer size of 512 which is pretty similar and we have no latency issues at all…

cheers for your help :)

Nov 21, 2011 at 6:21am

@ Rodrigo : I’m now exploring your patch so I’ll have some questions coming along the way. In your hipass filter, you use a +~ object instead of a -~as in the onepole helpfile. I don’t get it (but sure I’m not an expert in filter design).

Nov 21, 2011 at 7:42am

@ Rodrigo : there’s a strange distortion problem occuring at about 26000 ms if you record all or quasi all the buffer. Do you experience the same issue ? Closed and reopened the patch and it’s still occuring. Never happens if you stop recording before this time position so this has nothing to do with a ratio of the buffer recording.

Nov 21, 2011 at 8:34am

The hipass part is in there more as a precaution than anything else, but I’m inverting everything below 20hz then adding that bad into the signal effectively killing everything below 20hz (via phase cancellation).
I had a biquad in there originally, but a friend showed me this lower dsp version.

Just tested now and not getting any noise even if I fill the whole buffer. What kind of distortion are you getting?

Nov 22, 2011 at 6:05pm

Sounds a bit like noise reduction. I attach a mp3 file (so that you can hear the whole buffer content) recorded with the internal mic of my mbpro. Smart idea for the 20 hz kill.

  1. varispeedtest.mp3
Nov 22, 2011 at 6:44pm

Hmm that’s weird. I’m definitely not getting that noise.

If you record at a slower playback rate does it still happen around 26sec or does it happen at 87% of the buffer?
Does it happen while playing forwards and backwards?
Does it happen if you playback the buffer with a different object?
Is it visible in the waveform display?

Nov 22, 2011 at 8:41pm

When I record slower, it still happens at about 26300 ms but it seems less obvious. Happens fwd and bwd. not visible in the display. Also happens with play~ !!!

Nov 22, 2011 at 9:18pm

Does it happen if you load a 30sec sample into the buffer (as opposed to recording it in)?

Just trying to brainstorm what it is. It sounds more like jitter/bit reduction than noise reduction to me, so after 26sec or so, timing is going wonky.

Nov 22, 2011 at 9:55pm

I meant bit reduction but wrote ‘noise’… does not happen if I load a sample. What is really strange is that it seems to happen between circa 26300 to 28600 but as far as I can hear, the very end of the signal seems clean.

Nov 22, 2011 at 10:12pm

What seems like is happening (though it most definitely isn’t) is that groove/poke are drifting lock after 26sec and poke is writing non-adjacent samples, then it get’s back on track.

To rule one more thing out, can you try changing all the numbers to make the buffer 40sec (or more). you’d have to change quite a few things (all numbers in ms and samples). That way we can figure out if it’s related to the buffer size or something else.

Barring that, maybe shrink the whole thing down to 26sec and call it a day! For the life of me I can’t think of what can be happening. I just tested it on a different computer and it’s working fine there too. Recorded and played back the full 30sec buffer with no funny business.

Try different audio settings too perhaps?

Nov 23, 2011 at 8:33am

Turned the buffer to 40 ms. Happened between from circa 31250 to 34800… Reset my I/O vector size to 512 instead of 128, didn’t change anything. Now I’m going to try to set it to 25000 ms but it seems to always happen at the same time ratio in the buffer.

Nov 23, 2011 at 10:36am

Can anyone else reading this give the patch a spin to see if they can reproduce the problem? Or reproduce the problem not happening?

Nov 24, 2011 at 8:07pm

“The hipass part is in there more as a precaution than anything else, but I’m inverting everything below 20hz then adding that bad into the signal effectively killing everything below 20hz (via phase cancellation).”



You must be logged in to reply to this topic.