diff --git a/Sources/LyrebirdShoeGaze/Generators/ShimmerReverb.swift b/Sources/LyrebirdShoeGaze/Generators/ShimmerReverb.swift index a4ba69a..a97d0f1 100644 --- a/Sources/LyrebirdShoeGaze/Generators/ShimmerReverb.swift +++ b/Sources/LyrebirdShoeGaze/Generators/ShimmerReverb.swift @@ -25,9 +25,10 @@ private let shimmerReverbZeroBlock: [Double] = makeSampleBuffer() /// feedback = decay·damped + shimmer·pitched → written back into the tank /// ``` /// -/// The octave-up is a two-grain, 50%-overlap, Hann-windowed reader running at 2× over the tank -/// buffer (a tape-style pitch raise). A per-sample safety clamp + denormal flush keep the loop -/// bounded even at high `decay` / `shimmer`. +/// The octave-up is a two-grain, 50%-overlap, Hann-windowed reader running at 2× over the most +/// recent `grain` samples of the tank (the live wet content), a tape-style pitch raise whose +/// pitched output recirculates through the feedback. A per-sample safety clamp + denormal flush +/// keep the loop bounded even at high `decay` / `shimmer`. /// /// `size`, `decay`, `shimmer`, and `damp` are read at control rate (once per block). Output is mono. /// @@ -214,6 +215,8 @@ public final class ShimmerReverb: GeneratorBase, AudioGenerator { var writeVal: Double = diffused + decay * damped + shimmer * pitched if writeVal > safetyClamp { writeVal = safetyClamp } else if writeVal < -safetyClamp { writeVal = -safetyClamp } + // Flush denormals so they never recirculate in the tank (RT CPU guard). + if abs(writeVal) < denormalFloor { writeVal = 0.0 } tank[writePos] = writeVal out[i] = damped