View Single Post
Old 01-06-2019, 11:10 PM   #15
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 255
Default

Quote:
Originally Posted by Xenakios View Post
Your plugin is flawed if it depends for example on being fed silent buffers first before the actual audio. There's nothing in the plugin formats that would require hosts to do that. Your algorithms might need that but you will need to implement that internally in the plugin.
Many audio DSP processes require some amount of data history. Even a simple, second order IIR filter, for example, saves 2 old samples (n-1 and n-2) to be used in the calculation of the current output sample. If we simply initialize those two "old sample" variables to zero, the first few output samples from the plugin will not be correct since it is using zeros where there should be actual audio data.

So, to be 100% correct in this simple IIR example it seems we would want to report 2 samples of latency to the host and then add a 2 sample delay to the plugin. In that way the plugin will have time to completely fill with audio data before it produces its first output sample. More complex plugins that use FIR filters, FFTs, etc., may require multiple delays (reported as one overall latency value) where arrays and other variables need to be completely filled with audio data before any audio output is generated.

That seems to be the CORRECT way to design plugins yet I have never seen plugins that report only 2 samples of delay compensation to the host. I'm assuming that many designers ignore small errors and simply "zero out" the variables on initialization. In extreme cases this could cause the plugin to pop when first started (and I HAVE seen plugins do this!).

So, it seems it would be best practice to compensate every process that needs "old" values - and not just processes that require "look ahead" - to make sure every audio sample required in a plugin process is filled with real data before any output takes place. Yes?

Last edited by Nonlinear; 01-07-2019 at 12:35 AM.
Nonlinear is offline   Reply With Quote