From 40ab4bfe68704d5ed2e18ba215835e1f2ca89e50 Mon Sep 17 00:00:00 2001 From: Ludwig Date: Sun, 20 Apr 2025 11:48:11 +0200 Subject: [PATCH] Add little saturation to Leiwand setting --- Leiwandizer/Source/PluginProcessor.cpp | 9 +++++++++ Leiwandizer/Source/PluginProcessor.h | 1 + 2 files changed, 10 insertions(+) diff --git a/Leiwandizer/Source/PluginProcessor.cpp b/Leiwandizer/Source/PluginProcessor.cpp index 37fc159..be3d2a8 100644 --- a/Leiwandizer/Source/PluginProcessor.cpp +++ b/Leiwandizer/Source/PluginProcessor.cpp @@ -128,6 +128,14 @@ void LeiwandizerAudioProcessor::prepareToPlay (double sampleRate, int samplesPer gain.reset(); gain.setGainDecibels(-2.0f); + saturation.prepare(spec); + saturation.reset(); + saturation.functionToUse = [](float x) { + float satFactor = 0.05f; + x = satFactor * x; + return ( x / (1 + std::abs(x)) ) / satFactor; + }; + lowCutFilterOa.prepare(spec); auto lowCutOa = juce::dsp::IIR::Coefficients::makeHighPass(sampleRate, 100.0f, 5.0f); lowCutFilterOa.coefficients = *lowCutOa; @@ -236,6 +244,7 @@ void LeiwandizerAudioProcessor::processBlock (juce::AudioBuffer& buffer, lowShelfFilterLw.process(context); highShelfFilterLw.process(context); gain.process(context); + saturation.process(context); compressor.process(context); limiter.process(context); } diff --git a/Leiwandizer/Source/PluginProcessor.h b/Leiwandizer/Source/PluginProcessor.h index bc25766..00a3cb8 100644 --- a/Leiwandizer/Source/PluginProcessor.h +++ b/Leiwandizer/Source/PluginProcessor.h @@ -63,6 +63,7 @@ private: juce::dsp::Compressor compressor; juce::dsp::Limiter limiter; juce::dsp::Gain gain; + juce::dsp::WaveShaper saturation; //Oasch DSP juce::dsp::IIR::Filter lowCutFilterOa; juce::dsp::IIR::Filter highCutFilterOa;