Plugin Delay Compensation

As the subject implies, I am currently scratching my head over PDC. How would one best implement this in an AudioProcessorGraph?

My first guess was to just pass a shifted playhead to the processors depending on their latency (or: delayed MIDI input respectively). Playhead’s timeInSeconds would be offset to the left by the individual latency. But it I’m afraid that would only work if a synth with MIDI input is at the beginning of each path. It would also require to hack the AudioProcessorGraph class - not actually something I would like to do at this time.

Alternatively one could insert small delays (implemented as an internal plugin) at the end of each path, immediately before it meets the graph output. This would delay the fast paths to exactly meet the slower paths at the graph output. From my gut feeling, this sounds more reasonable and easier to implement.

Any thoughts? Has anyone ever done this with Juce?

P.S: Does anyone know how to make a sample-accurate delay processor?

There’s already a thread about PDC in an AudioProcessorGraph including a solution somewhere in the forum :slight_smile:

What do you mean by “sample accurate delay processor” ? Do you mean you want to your delay to process paramter automation (time,feedback,…) in sync with each sample ?

Sorry, I didn’t notice the “slow manipulations” discussion evolved towards PDC - thanks. Very interesting thread.

By sample-accurate delay I mean “delay by n samples”, where n is not a multiple of the block size. No automattion, just delay the audio stream.

Just create a buffer with at least the desired length and have a read- and a write-pointer that are n samples apart…