A possible mistake in the Juce 6 phaser module

Hi, im not sure if this is the best place to report this but it seems there is a problem in the way the phaser module is updating the centre freq. It may be that I am not using this correctly, please do tell me if that is so.

template <typename SampleType>
void Phaser<SampleType>::setCentreFrequency (SampleType newCentreHz)
{

    jassert (isPositiveAndBelow (newCentreHz, static_cast<SampleType> (sampleRate * 0.5)));

    centreFrequency = newCentreHz;

    normCentreFrequency = mapToLog10 (centreFrequency, static_cast<SampleType> (20.0), static_cast<SampleType> (jmin (20000.0, 0.49 * sampleRate)));
}

The calculation of the normCentreFrequency variable is returning +inf in most cases when passed a frequency in Hz.

If passed a value between 0 and one it gives a real number value, but one too low to really function in the phaser.

the fix I have used is the slightly hacky :

template <typename SampleType>
void Phaser<SampleType>::setCentreFrequency (SampleType newCentreHz)
{
    jassert (isPositiveAndBelow (newCentreHz, static_cast<SampleType> (sampleRate * 0.5)));

    centreFrequency = newCentreHz;

    normCentreFrequency = (newCentreHz - static_cast<SampleType> (20.0)) / ( static_cast<SampleType> (jmin (20000.0, 0.49 * sampleRate)) - static_cast<SampleType> (20.0) );
}

Which at least seems to get the phaser working but not to a logarithmic value and possable not as intended, somebody more familiar with the code base may have a better solution.

Thanks.

2 Likes

Thank you for reporting.

This has been fixed on the develop branch: https://github.com/juce-framework/JUCE/commit/2f9b301cb702a7023b979b21272149b77efd0427

1 Like