Latency Compensation

Tim Lloyd's icon

Hi there, I'm trying to make a simple LFO vibrato, but am having trouble with latency causing phasing when using a dry/wet mix control.

Is there a way of detecting how many samples of latency a sub-patch is adding to an audio signal? If there is I could just put a delay~ of those samples on the dry input that is mixed with the vibrato.

Also, is there a limit to how many instances of the fft~ patch I could use at once? I don't want to compromise the sound quality by using a smaller fft size and overlap, so would using poly~ make it possible to use more instances? It might be worth mentioning I'm planning to use the vibrato in a patch for processing live vocals and guitars, so latency is a big concern.

The patch is attached below, it needs analogue~ for the LFO, which is included in the zip file.

Thanks for the help!

(the pan abstraction I'm using for the wet/dry mix was pilfered from somewhere on this forum, so cheers to whoever made it)

Roman Thilenius's icon

the latency of an fft 1024 is 1024*2==2048 samples.

Tim Lloyd's icon

Ok thanks.

so just to clarify, if I have:

pfft~ (patchername) 4096 4

the latency is 4096*2 which would be 371 milliseconds? I must be misunderstanding, the latency sounds to be around 10 to 20ms.

OR, as fft~ defaults to 512, the latency would be 1024, or 21ms?

I'll need to do some reading up on this I think.

I just opened the vibrato patch, and when running a sine wave through the input, with the vibrato turned on, having the mix dial in the middle causes distortion, but not when it is at either extreme. I don't understand why this is, because the pan abstraction actually attenuates the gain slightly when panned to the middle (mix dial == pan input)

It may be this distortion I was hearing when testing it with audio files rather than latency.

Roman Thilenius's icon

Quote:the latency is 4096*2 which would be 371 milliseconds?

about 200 ms at 44.1 kHz or 85 ms at 96 kHz.

think of latency always in samples. == use the [delay~]
object in conjunction with FFT stuff, nothing else.

4094 is a lot! make sure if you can not maybe do with less.

Tj Shredder's icon

Never believe, test it yourself:

Max Patch
Copy patch and select New From Clipboard in Max.