Harsh noise on plugin start

My audio plugin emits an harsh high frequency noise when it starts once every 6/7 times. It is a simple wavetable synthesiser with an exponential decay envelope. The wavetable is generated by reading a .wav file, and there should be no dangling pointers as I am using only unique_pointers.
My wavetable class is modelled on the juce tutorial and the envelope is modelled on the Audio Programming Book examples
Apart from that noise on start-up the plugin works smoothly.
I know it is like searching a needle into a haystack but which other things should I keep in mind while searching for my bug?
In the plugin editor I have many images that I get as ImageCache from binary data. Could that be the problem?
P.s. I am not making the #1 beginner mistake

Thanks for any tip.

You can opt to return a GenericAudioProcessorEditor to remove your editor from the equation and quickly rule that out.

my initial guess would be that you resized some buffer (probably in prepareToPlay or so), but didn’t give it a default value of 0. if you use std::vector as audio buffer, always use the 2nd optional arg of resize to make sure that it’s not garbage values, but 0.

buffer.resize(blockSize, 0.f);

when resizing juce::AudioBuffer there’s also an option to clear it on setSize

1 Like

it was a good idea to try it, but noise is till there ;(

Sometimes it’s caused by uninitialized variables.

it was indeed a resized buffer and clearing the extra space with setSize solved the problem. thank you very much.

1 Like