diff --git a/modules/juce_audio_basics/utilities/juce_SmoothedValue.h b/modules/juce_audio_basics/utilities/juce_SmoothedValue.h index 3db19ac291..047434e49d 100644 --- a/modules/juce_audio_basics/utilities/juce_SmoothedValue.h +++ b/modules/juce_audio_basics/utilities/juce_SmoothedValue.h @@ -188,17 +188,29 @@ namespace ValueSmoothingTypes //============================================================================== /** - A utility class for values that need smoothing, like volume, that should not - change abruptly to avoid audio glitches. + A utility class for values that need smoothing to avoid audio glitches. - To smooth values spread across an exponential range, where the increments - between the current and target value are multiplicative (like frequencies), - you should pass the multiplicative smoothing type as a template parameter: + A ValueSmoothingTypes::Linear template parameter selects linear smoothing, + which increments the SmoothedValue linearly towards its target value. + + @code + SmoothedValue yourSmoothedValue; + @endcode + + A ValueSmoothingTypes::Multiplicative template parameter selects + multiplicative smoothing increments towards the target value. @code SmoothedValue yourSmoothedValue; @endcode + Multiplicative smoothing is useful when you are dealing with + exponential/logarithmic values like volume in dB or frequency in Hz. For + example a 12 step ramp from 440.0 Hz (A4) to 880.0 Hz (A5) will increase the + frequency with an equal temperament tuning across the octave. A 10 step + smoothing from 1.0 (0 dB) to 3.16228 (10 dB) will increase the value in + increments of 1 dB. + Note that when you are using multiplicative smoothing you cannot ever reach a target value of zero! @@ -386,6 +398,9 @@ private: template using LinearSmoothedValue = SmoothedValue ; + +//============================================================================== +//============================================================================== #if JUCE_UNIT_TESTS template diff --git a/modules/juce_dsp/maths/juce_LogRampedValue.h b/modules/juce_dsp/maths/juce_LogRampedValue.h index 0e045c6c01..7af99bc5da 100644 --- a/modules/juce_dsp/maths/juce_LogRampedValue.h +++ b/modules/juce_dsp/maths/juce_LogRampedValue.h @@ -31,15 +31,18 @@ namespace dsp //============================================================================== /** - Utility class for logarithmically smoothed values. + Utility class for logarithmically smoothed linear values. Logarithmically smoothed values can be more relevant than linear ones for specific cases such as algorithm change smoothing, using two of them in opposite directions. + The gradient of the logarithmic/exponential slope can be configured by + calling LogRampedValue::setLogParameters. + @see SmoothedValue - @tags{Audio} + @tags{DSP} */ template class LogRampedValue : public SmoothedValueBase >