ScriptNode Pitch Shift Node - Delay Compensation
-
If I wanted to use this what would be a method of compensating for the delay it produces?
-
@DanH I'm just guessing at a solution here but perhaps use a delay on the dry portion of your signal (equal to the delay time introduced by the pitch shift), then you can use Engine.setLatency to dynamically readjust to your total delay time (in samples). There probably is a better solution for delay compensation however.
-
@HISEnberg Do you know if that can that be done on the fly? i.e will a DAW be able to then compensate for the sudden shift in latency?
-
@DanH When I read the documentation (there’s more about it in the JUCE docs) the answer is yes, but that always raises suspicion for me. I know it definitely does on the recorded output (I usually test this by loading an impulse on the channel with the plugin, then record it to a new channel and compare them on the sample level).
But how it can be done in real-time playback doesn’t compute for me, since hypothetically there is no way to delay the signal, fill the buffer, then move it back in time by the proper amount of samples. I guess I should test this with just a delay module and check for phase incoherence but this is the furthest I have gotten.
That being said, if your input/dry signal is delayed by the same amount of samples as is introduced by the pitch shifter, then you won’t hear any phasing in so far as your plugin goes!
Sorry for the ramble I hope that’s moderately clear. Just make sure you operate in samples and not milliseconds, so if you are operating at different sample rates the latency difference is consistent!
-
@HISEnberg Yeah that makes sense. As long as when you restart the DAW playback it can account for the latency changes that would be fine. I'l' run some tests when I find time
-
I think using
Engine.setLatency
dynamically can be problematic.Instead, after the maximum delay value caused by pitchshift is set in Engine.setLatency, the difference can be balanced dynamically with a delay node according to the parameter values ​​that give less delay.