Hi,
I want to mix two signal in a exp way.
Usually I’ll crossfade this way on other app (linearly):
return a + (b - a) * p;
Is there any “out-of-the-box” helpers on Juce to do this exponentially? Giving a non-linear slope on mixing two signals?
Thanks for any tips.
check out the dsp::DryWetMixer class
1 Like
Tried, but it seems do nothing:
void AudioPluginAudioProcessor::processBlock(juce::AudioBuffer<float> &buffer, juce::MidiBuffer &midiMessages)
{
juce::ignoreUnused(midiMessages);
auto *left = buffer.getWritePointer(0);
auto *right = buffer.getWritePointer(1);
mixer.pushDrySamples(buffer);
mixer.setWetMixProportion(0.5f);
for (int i = 0; i < buffer.getNumSamples(); i++) {
// process left[i]...
}
mixer.mixWetSamples(buffer);
}
Am I wrong?
Maybe do I need to clone the buffer? And use it for wet one?
I only see example that use context and process, not processBlock.
Any tips please?
Yes, you need to clone the buffer before processing it with your effect. Create another buffer as a member of your processor and initialize it in prepareToPlay. In processBlock, before your for loop, just do dryBuffer.copyFrom(buffer), so you’ll have a copy of your incoming and unprocessed signal.
If you want a mix that’s not linear, look for “equal power crossfade”. This one works great for uncorrelated signals.
Cheers,
Luca
1 Like