@HISEnberg said in How to optimize Scriptnode Networks?:
How to measure the latency introduced by my Scriptnode network? I imagine driving an impulse through the plugin and recording the output should reveal this (for a DAW specific context). Is this something Plugin Doctor can measure, or does someone have a better methodology?
You can do a Null test in your DAW for this.
One channel will be the dry (unprocessed) signal. The other channel will be the processed signal, that is, the channel where the plugin is.Make one channel phase invert. If these two channels are identical, the overall result will be silence. Since there is a delay at the sample level in the channel where the plugin is, determine the amount of sample delay required until the result of the combination of these two channels is silence with a sample delay in the dry channel.
The amount of delay you will apply to silence the sound in the dry channel is the amount of delay created by your plugin's DSP.
How to compensate for latency introduced by the Scriptnode network? I see in the API Engine.setLatencySamples, but it is unclear to me what it does. Are we meant to measure the latency of the scriptnode network (for example 32 samples) and this function will broadcast to the host the latency introduced by the plugin (i.e. "this plugin introduces 32 samples of latency, so compensate for that")? What does the host actually do with this information?
If your plugin has a delay of 32 samples, the DAW will play your plugin 32 samples ahead, thus compensating for the delay. Therefore, it is necessary to inform the DAW of this delay value with Engine.setLatencySamples.