commit 3374247b61319135b059d3b3336798ec00e68018
parent 00d6080fcb5a03b1574d5ee9d47db97c5ccf56c2
Author: Steven Atkinson <steven@atkinson.mn>
Date: Thu, 27 Jul 2023 22:22:47 -0500
Apply high-pass filter to remove DC offset present in some models (#349)
* HPF in, LPF in but commented out
* Track NeuralAmpModelerCore commit with HPF/LPF
Diffstat:
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/NeuralAmpModeler/NeuralAmpModeler.cpp b/NeuralAmpModeler/NeuralAmpModeler.cpp
@@ -343,12 +343,23 @@ void NeuralAmpModeler::ProcessBlock(iplug::sample** inputs, iplug::sample** outp
if (mIR != nullptr && GetParam(kIRToggle)->Value())
irPointers = mIR->Process(toneStackOutPointers, numChannelsInternal, numFrames);
+ // And the HPF for DC offset (Issue 271)
+ const double highPassCutoffFreq = 5.0;
+ // const double lowPassCutoffFreq = 20000.0;
+ const recursive_linear_filter::HighPassParams highPassParams(sampleRate, highPassCutoffFreq);
+ // const recursive_linear_filter::LowPassParams lowPassParams(sampleRate, lowPassCutoffFreq);
+ mHighPass.SetParams(highPassParams);
+ // mLowPass.SetParams(lowPassParams);
+ sample** hpfPointers = mHighPass.Process(irPointers, numChannelsInternal, numFrames);
+ // sample** lpfPointers = mLowPass.Process(hpfPointers, numChannelsInternal, numFrames);
+
// restore previous floating point state
std::feupdateenv(&fe_state);
// Let's get outta here
// This is where we exit mono for whatever the output requires.
- _ProcessOutput(irPointers, outputs, numFrames, numChannelsInternal, numChannelsExternalOut);
+ _ProcessOutput(hpfPointers, outputs, numFrames, numChannelsInternal, numChannelsExternalOut);
+ // _ProcessOutput(lpfPointers, outputs, numFrames, numChannelsInternal, numChannelsExternalOut);
// * Output of input leveling (inputs -> mInputPointers),
// * Output of output leveling (mOutputPointers -> outputs)
_UpdateMeters(mInputPointers, outputs, numFrames, numChannelsInternal, numChannelsExternalOut);
diff --git a/NeuralAmpModeler/NeuralAmpModeler.h b/NeuralAmpModeler/NeuralAmpModeler.h
@@ -166,6 +166,10 @@ private:
recursive_linear_filter::Peaking mToneMid;
recursive_linear_filter::HighShelf mToneTreble;
+ // Post-IR filters
+ recursive_linear_filter::HighPass mHighPass;
+ // recursive_linear_filter::LowPass mLowPass;
+
// Path to model's config.json or model.nam
WDL_String mNAMPath;
// Path to IR (.wav file)