Skip to content

Commit 1f3585c

Browse files
authored
Specify tail size based on DC blocker (#361)
1 parent 96b2500 commit 1f3585c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

NeuralAmpModeler/NeuralAmpModeler.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
using namespace iplug;
2020
using namespace igraphics;
2121

22+
const double kDCBlockerFrequency = 5.0;
23+
2224
// Styles
2325
const IVColorSpec colorSpec{
2426
DEFAULT_BGCOLOR, // Background
@@ -345,7 +347,7 @@ void NeuralAmpModeler::ProcessBlock(iplug::sample** inputs, iplug::sample** outp
345347
irPointers = mIR->Process(toneStackOutPointers, numChannelsInternal, numFrames);
346348

347349
// And the HPF for DC offset (Issue 271)
348-
const double highPassCutoffFreq = 5.0;
350+
const double highPassCutoffFreq = kDCBlockerFrequency;
349351
// const double lowPassCutoffFreq = 20000.0;
350352
const recursive_linear_filter::HighPassParams highPassParams(sampleRate, highPassCutoffFreq);
351353
// const recursive_linear_filter::LowPassParams lowPassParams(sampleRate, lowPassCutoffFreq);
@@ -369,6 +371,11 @@ void NeuralAmpModeler::ProcessBlock(iplug::sample** inputs, iplug::sample** outp
369371
void NeuralAmpModeler::OnReset()
370372
{
371373
const auto sampleRate = GetSampleRate();
374+
// Tail is because the HPF DC blocker has a decay.
375+
// 10 cycles should be enough to pass the VST3 tests checking tail behavior.
376+
// I'm ignoring the model & IR, but it's not the end of the world.
377+
const int tailCycles = 10;
378+
SetTailSize(tailCycles * (int)(sampleRate / kDCBlockerFrequency));
372379
mInputSender.Reset(sampleRate);
373380
mOutputSender.Reset(sampleRate);
374381
mCheckSampleRateWarning = true;

0 commit comments

Comments
 (0)