diff --git a/deployment/VL.Audio.nuspec b/deployment/VL.Audio.nuspec index ea19c6a..403136f 100644 --- a/deployment/VL.Audio.nuspec +++ b/deployment/VL.Audio.nuspec @@ -2,7 +2,7 @@ VL.Audio - 1.3.2-preview + 1.3.3-preview VL.Audio NAudio, vvvv vvvv diff --git a/src/Signals/Filters/AnalogModelingFilterSignal.cs b/src/Signals/Filters/AnalogModelingFilterSignal.cs index 407e087..eedea28 100644 --- a/src/Signals/Filters/AnalogModelingFilterSignal.cs +++ b/src/Signals/Filters/AnalogModelingFilterSignal.cs @@ -257,11 +257,19 @@ void MoogLadder(float[] buffer, int offset, int count) y4 = y3 * p + oldy3 * p - k * y4; //Clipper band limited sigmoid y4 -= (y4 * y4 * y4) / 6.0f; + + //prevent NAN clipping when input signal is too loud + x = !float.IsNaN(x) ? x : 0; + y1 = !float.IsNaN(y1) ? y1 : 0; + y2 = !float.IsNaN(y2) ? y2 : 0; + y3 = !float.IsNaN(y3) ? y3 : 0; + y4 = !float.IsNaN(y4) ? y4 : 0; + oldx = x; oldy1 = y1; oldy2 = y2; oldy3 = y3; - + switch (FilterType.Value) { case AnalogModelingFilterType.LowPass: @@ -279,6 +287,4 @@ void MoogLadder(float[] buffer, int offset, int count) } } -} - - +} \ No newline at end of file