StateVariableTPTFilter pops on fast modulation

Hi there!

I wanted to raise an issue I’m facing with the StateVariableTPTFilter. After couple of days trying to solve it following multiple threads on the forum and tutorials, I’m a bit lost with these… “pops”.

I have this juce project in this repo GitHub - anasaidata/beatgone

This repo contains just small modifications of AudioProgrammer Synth tutorial GitHub - TheAudioProgrammer/tapSynth at tutorialSeries

My issue resides on the fast modulation of the Filter cutoff frequency. This high modulation creates pops and a lot of frequencies rise in the EQ.

Does anyone knows how to avoid these “pops” on fast frequency modulation?

TPT filters shouldn’t pop. It’s one of the main attractions to using them over the usual direct form biquads. Without running your code, the pop could be causing frequencies to appear or you might be seeing side bands which also appear under phase modulation.

At what modulation frequency in Hz are you hearing the pops?

Thank you very much for your answer!

Indeed I explored different filters and discovered that TPT filtar has this main attraction of Not pops.

It only pops when fast modulating on very low Hz (20-400) aprox.

The “pop” generates lot of frequencies to raise (mainly in the low band), but also a bit in mids and very few high freqs

What you suggest? Maybe you know about a propper filter TPT filter implementation? Just one synth voice with 1 Sine Osc and 1 filter?

I also tried just applying the filter with no Envelopes but the issue remains :confused:

When does it pop? While you’re holding down just one note, or when you switch notes?

Mainly when holding the note down + fast modulation.

Of course if I apply a high attack on the modulation envelope then just pressing the note generates a bit of “pop”

Are you sure it’s not the modulation itself that has the problem? Or how you compute the cutoff frequency during the modulation?

EDIT: I just tried running your code but it crashes all over the place. You seem to have some kind of memory allocation error.

I have the updateFilter method on the SynthVoice.cpp

This method is called in the PluginProcessor.cpp in the “processBlock”:

**void** SynthVoice::updateFilter (**const** **int** filterType, **const** **float** frequency, **const** **float** resonance)

{

**auto** modulator = filterAdsr.getNextSample();

filter.updateParameters (modulator, filterType, frequency, resonance);

}

And then

void FilterData::updateParameters (const float modulator, const int filterType, const float frequency, const float resonance)
{
    switch (filterType)
    {
        case 0:
            filter.setType (juce::dsp::StateVariableTPTFilterType::lowpass);
            break;
            
        case 1:
            filter.setType (juce::dsp::StateVariableTPTFilterType::bandpass);
            break;
            
        case 2:
            filter.setType (juce::dsp::StateVariableTPTFilterType::highpass);
            break;
    }
    
    float modulatedFreq = frequency * modulator;
    modulatedFreq = std::fmax (std::fmin (modulatedFreq, 20000.0f), 20.0f);
    
    filter.setCutoffFrequency (modulatedFreq);
    filter.setResonance (resonance);
}

The thing is that I tried with the envelope disabled and it’s still there the pop

Is a project for Xcode… don’t know if can be something like that… for me is working.

Thank you very much for all your help! and your time :slight_smile:

First thing, don’t set the filter type inside updateParameters. It may be that the filter state is being reset there which could well cause audio glitches.

Yes I tried directly with adhoc lowpass filter set up in the “FilterData::prepareToPlay” and no luck :frowning:

EDIT: it is true that if any voice is playing and I change the filter type then it Clicks. I can improve that part to avoid those clicks but for sure removing the update filter type on the “updateParameters” is not fixing the pops due to fast modulation