Skip to content

Commit

Permalink
Make DC blocker coefficient depend on sample rate
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeoliphant committed Apr 9, 2024
1 parent 1626e74 commit 72fd4a1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/nam_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,14 @@ namespace NAM {
}
}

float dcBlockCoefficient = 1 - (220.0 / sampleRate);

for (unsigned int i = 0; i < n_samples; i++)
{
float dcInput = ports.audio_out[i];

// dc blocker
ports.audio_out[i] = ports.audio_out[i] - prevDCInput + 0.995 * prevDCOutput;
ports.audio_out[i] = ports.audio_out[i] - prevDCInput + dcBlockCoefficient * prevDCOutput;

prevDCInput = dcInput;
prevDCOutput = ports.audio_out[i];
Expand Down

0 comments on commit 72fd4a1

Please sign in to comment.