Cabbage Logo
Back to Cabbage Site

Feature request: report latency

There are a few opcodes in Csound that introduce latency (e.g. pconvolve). As far as I know, all major plug-in formats support reporting any internal delay to the DAW so it can compensate for the delay.

Would be great if there was a way to indicate the amount of latency in a .csd so that a Cabbage plug-in can in turn report it to the DAW.

The amount of latency is set by ksmps. This makes sense because output only begins after a k-cycle, which is ksmps samples. This is something that Cabbage does automatically. But if you would like to have control over this I can look into it, but using ksmps seems to be the best option.

That’s true, but that is only one source of potential latency. Even after playback starts, various opcodes and instruments might introduce additional latency, e.g. through internal buffering and processing before they can start playback.

For example, the manual entry for pconvolve notes:
The overall latency of the opcode can be calculated as such [assuming ipartitionsize is a power of 2]
ilatency = (ksmps < ipartitionsize ? ipartitionsize + ksmps : ipartitionsize)/sr

This is obviously dependent on the specific orchestra code, so there is no way for Cabbage to determine the total latency on its own. That’s why it would be great if this additional latency could be specified.

Ok. I’ve added a new identifier called latency(), which takes a number of samples. This will add a user defined amount of latency, or plugin delay compensation, as some hosts call it. I haven’t had a chance to test it yet, but you can find the new build here once it’s cooked.

Note, the default is still ksmps.

Thanks Rory, will check it out.