Skip to content

Commit

Permalink
Reduce gain of IRs (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdatkinson authored Mar 19, 2023
1 parent 9a3f28c commit 91a2bdb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dsp/ImpulseResponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ void dsp::ImpulseResponse::_SetWeights(const double sampleRate) {
// Simple implementation w/ no resample...
const size_t irLength = std::min(this->mResampled.size(), this->mMaxLength);
this->mWeight.resize(irLength);
// Gain reduction.
// https://github.com/sdatkinson/NeuralAmpModelerPlugin/issues/100#issuecomment-1455273839
// Add sample rate-dependence
const float gain = pow(10, -18 * 0.05) * 48000/sampleRate;
for (size_t i = 0, j = irLength - 1; i < irLength; i++, j--)
this->mWeight[j] = this->mResampled[i];
this->mWeight[j] = gain * this->mResampled[i];
this->mHistoryRequired = irLength - 1;
}

0 comments on commit 91a2bdb

Please sign in to comment.