macOS: Standalone build works but AU plugin glitches

I have a plugin synth which had been released a few years ago.
I have released several updates and the last one was released on May 2021.

Now I’ve finished coding my latest version and I’m building the release binaries.
Win/VST works well, mac Standalone works well, but mac AU glitches.

The glitching AU plugin loads without any error on Logic Pro X, but once the audio processing starts it makes extreme noise.
The noise is rather tonal than random, I kind of remember hearing this kind of noise when I had set an extreme value into the rendering buffer.

I don’t think my code is essentially wrong because the Win-VST version and Mac Standalone version work, and what’s more, I have reverted my code to the previous release(the May '21 one) and it makes the same glitch(!).

What I have done besides the code since my last release are:

  • Updated JUCE (5.4.5 → 6.1.5)
  • Updated Xcode (12.x(forgot the exact version) → 13.2.1)

Any info appreciated.
Thanks

Additional tries:

  • AU didn’t work with JUCE 6.0.8+Xcode 12.4.
  • mac-VST worked with JUCE 6.1.5+Xcode13

One more try:

  • Tried to build with JUCE 5.4.5 but didn’t success for Rez error. It looks similar to this but changing #include <AudioUnit/AudioUnit.r> to #include <AudioUnit.r> didn’t work.

Pretty strange.
My rendering block of SynthesizerVoice starts like this, which does nothing when no note is played.
But the plugin starts making noise immediately after launched, even no key is pressed.

void BaseVoice::renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples)
{
    if (getCurrentlyPlayingNote() == -1) { //A
        return;
    }
    //B

I set the breakpoint at //B to make sure the condition //A works. As result, the condition works, breakpoint is never hit, and the noise starts immediately.

Maybe just clear the output buffer before return?

2 Likes

Bingo
You saved my day!

void MyProcessor::processBlock (AudioBuffer<float>& buffer, MidiBuffer& midiMessages)
{
    buffer.clear(); // Added!
    synth.renderNextBlock (buffer, midiMessages, 0, buffer.getNumSamples());
}

The trick was to do it in Plugin Processor, not in Voice.

Why my previous versions didn’t have this glitch?
Maybe I should dig into the JUCE AU code and its history.

But anyway, my present problem is fixed.
Thanks a lot!

I had a permanent, full volume tone in my build of the sampler plugin example. Seemed like a feedback loop.

Adding buffer.clear() has fixed this. Would love to understand what the actual cause of this is if it has been figured out yet?

Edit: My issue was caused with building a VST3 on OSX.