buffer.addFrom problem

  1. White and Pink Noise: The generation and mixing of white and pink noise are problematic. Despite attempts to add these noises to the main buffer, there’s no audible output when using the addFrom function.
  2. WAV Files: Loading and playing WAV files (Vinyl and Tape sounds) seem to override other sources. When attempting to mix these files with the noise sources, they become the dominant output, so not even a sound ran trough the VST is audible.

Here is my code.
PluginEditor.cpp (15.0 KB)
PluginEditor.h (2.9 KB)
PluginProcessor.cpp (11.2 KB)
PluginProcessor.h (4.4 KB)

I am sorry if I have not specified my problem completely. When I am trying to mix my .wav file with the buffer using the addFrom function,

buffer.addFrom(channel,0,tempBuffer,channel,0,buffer.getNumSamples());

The buffer gets overriden by this function (which from what I read in the documentation should not be the case). Thank you for your help again.

Juce Community. I am on my knees. I have yearly work that is due to the 19th and I need your help with this problem. I have tried everything. Searched every forum. Nothing. Please. Anyone.

so you read a sample into tempBuffer
then you mix the main buffer with some noise
then you ramp the sample from tempBuffer with noiseAmount
then you add to the main buffer with the ramped sample content

then you filter the main buffer

comment one stuff at a time and put breakpoint and you will see the light.

thanks for help but nothing changed. I guess I can just use the white and pink noise. Thanks for the answer though. The problem seems to be with me setting the temp buffer to the same size as the buffer.

From a quick look at your PluginProcessor.cpp, you’re calling setSize on tempBuffer at the start of every process call which allocates memory on the audio thread. This is generally a big no-no in realtime audio since its execution time is unbounded - instead, preallocate tempBuffer (might want a rename) by setting its size in prepareToPlay().

Also, your if statement on line 290 if (tempBuffer.getNumSamples() > 0) will always be true since you set the size of tempBuffer at the start of the processBlock(). This might mean you’re adding garbage from tempBuffer when it hasn’t been filled yet.

I’d be surprised if this fixes your issue, so if it doesn’t I’d recommend debugging by stepping through each part of your processBlock() and checking your tempBuffer is filled properly (perhaps copy your tempBuffer into your buffer to monitor it?).