AAX Plugin looking ahead? *,*

G’day folks, I’m making a drum replacement plugin that plays a sample when triggered by a certain threshold level from the input.
The funny thing is that the plugin seems to be “looking ahead” from the actual playback in pro tools, so the sample ends up playing earlier than the actual transient from the input. However, when the plugin is listening to a real-time input from the microphone, the bug is gone (the sample is played after the input detection, as it was meant to be).

When I run these tests, there are no other plugins introducing any delay compensation. And my plugin is also not delay compensated yet, so it is set to zero.

Any thoughts?

Thanks in advance.

Here’s my process block:

void TriggerAudioProcessor::processBlock (AudioBuffer<float>& buffer, MidiBuffer& midiMessages)

	auto mainIO = getBusBuffer (buffer, true, 0);
	auto scInput = getBusBuffer (buffer, true, 0);

	double sampleRate = getSampleRate();
	int bufferSize = buffer.getNumSamples();
	int numChannels = buffer.getNumChannels();
	int midiEvent = midiMessages.getFirstEventTime();

	float detectorThresholdValue = *parameters.getRawParameterValue("threshold");

	int timeBetweenNotes = 60; //ms

	for (int j = 0; j < bufferSize; ++j) //for each sample
		if (midiEvent == 0 || j != midiEvent)
		if (t==0)
   if (detect (scInput,numChannels, detectorThresholdValue, sampleRate, j))
	   if (!midiEnable)
		   midiMessages.clear(); // no midi input
	   //samplerSynth.noteOff(1, 60, 0, false);
	   samplerSynth.noteOn(1, 60, 1);  // it plays
	   t = sampleRate*timeBetweenNotes*0.001;

		} //t=0
		if (t>0) //time countdown
	}//unique sample handle


	scInput.clear(); //
	mainIO.clear(); // clears both buffers for now

	samplerSynth.renderNextBlock(mainIO, midiMessages, 0, bufferSize); // renders output

	midiMessages.clear(); //clears midi buffer;


Sorry to bump this old thread, but did you find out more about this ? I’m having some issues with AAX right now that might point in the same direction.

Reaper has anticipative FX processing, but it can be disabled. The behaviour in ProTools is similar to the behaviour in Reaper when the anticipative processing is enabled. Unfortunately, in ProTools i haven’t found any option regarding this …

if you trigger on a audio treshold in a frame, the midi is generated as if it happened at the very first sample of the frame… (unless you add some complicated midi timecode to fix it: it should instruct the synth to add a bit of latency that equals the offset of your trigger in your frame…)
So the lower the buffersetting in your DAW, the lesser this effect will be…
You can circumvent it, by generating the midi note in the next frame. Ofcourse this will increase the latency: it is a choice here: have lowest possible latency with a chance of too early triggers, or have stable longer latency without premature triggers.