From 221cf0cd64ee07898335d057bf041d43efd95582 Mon Sep 17 00:00:00 2001 From: Andreya-Autumn <105538426+Andreya-Autumn@users.noreply.github.com> Date: Wed, 16 Oct 2024 00:10:34 +0200 Subject: [PATCH] Clamp noise tilt (#148) --- include/sst/voice-effects/eq/TiltEQ.h | 3 ++- include/sst/voice-effects/generator/TiltNoise.h | 2 +- include/sst/voice-effects/modulation/NoiseAM.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/sst/voice-effects/eq/TiltEQ.h b/include/sst/voice-effects/eq/TiltEQ.h index 8149583..ec50944 100644 --- a/include/sst/voice-effects/eq/TiltEQ.h +++ b/include/sst/voice-effects/eq/TiltEQ.h @@ -73,7 +73,8 @@ template struct TiltEQ : core::VoiceEffectTemplateBasenote_to_pitch_ignoring_tuning(this->getFloatParam(fpFreq)); - float slope = this->getFloatParam(fpTilt) / 2; + float slope = std::clamp(this->getFloatParam(fpTilt), -18, 18) / 2; + float posGain = this->dbToLinear(slope); float negGain = this->dbToLinear(-1 * slope); float res = .07f; diff --git a/include/sst/voice-effects/generator/TiltNoise.h b/include/sst/voice-effects/generator/TiltNoise.h index 9876a1e..b2e98ca 100644 --- a/include/sst/voice-effects/generator/TiltNoise.h +++ b/include/sst/voice-effects/generator/TiltNoise.h @@ -96,7 +96,7 @@ template struct TiltNoise : core::VoiceEffectTemplateBasegetFloatParam(fpTilt) / 2; + float slope = std::clamp(this->getFloatParam(fpTilt), -3, 3) / 2; float posGain = this->dbToLinear(slope); float negGain = this->dbToLinear(-1 * slope); float res = .07f; diff --git a/include/sst/voice-effects/modulation/NoiseAM.h b/include/sst/voice-effects/modulation/NoiseAM.h index ccedf2c..2090f00 100644 --- a/include/sst/voice-effects/modulation/NoiseAM.h +++ b/include/sst/voice-effects/modulation/NoiseAM.h @@ -111,7 +111,7 @@ template struct NoiseAM : core::VoiceEffectTemplateBasegetFloatParam(fpTilt) / 2; + float slope = std::clamp(this->getFloatParam(fpTilt), -3, 3) / 2; float posGain = this->dbToLinear(slope); float negGain = this->dbToLinear(-1 * slope); float res = .07f;