Skip to content

Commit

Permalink
Fix bug with ladder filter feedback and first stage
Browse files Browse the repository at this point in the history
  • Loading branch information
ndonald2 committed Feb 23, 2024
1 parent d54d875 commit 0dd093c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Source/Filters/ladder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// Huovilainen New Moog (HNM) model as per CMJ jun 2006
// Richard van Hoesel, v. 1.03, Feb. 14 2021
// v1.7 (Infrasonic/Daisy) add configurable filter mode
// v1.6 (Infrasonic/Daisy) removes polyphase FIR, uses 2x linear
// v1.6 (Infrasonic/Daisy) removes polyphase FIR, uses 4x linear
// oversampling for performance reasons
// v1.5 adds polyphase FIR or Linear interpolation
// v1.4 FC extended to 18.7kHz, max res to 1.8, 4x oversampling,
Expand Down Expand Up @@ -75,15 +75,14 @@ float LadderFilter::Process(float in)
float interp = 0.0f;
for(size_t os = 0; os < kInterpolation; os++)
{
float u = (interp * oldinput_ + (1.0f - interp) * input)
- (z1_[3] - pbg_ * input) * K_ * Qadjust_;
float in_interp = (interp * oldinput_ + (1.0f - interp) * input);
float u = in_interp - (z1_[3] - pbg_ * in_interp) * K_ * Qadjust_;
u = fast_tanh(u);
float stage1 = LPF(u, 0);
float stage2 = LPF(stage1, 1);
float stage3 = LPF(stage2, 2);
float stage4 = LPF(stage3, 3);
total += weightedSumForCurrentMode(
{input, stage1, stage2, stage3, stage4})
total += weightedSumForCurrentMode({u, stage1, stage2, stage3, stage4})
* kInterpolationRecip;
interp += kInterpolationRecip;
}
Expand Down

0 comments on commit 0dd093c

Please sign in to comment.