I am new to coding and am trying to create a plugin with a stereo Low Pass Filter in it. I am trying to use the dsp module to do this. I have tried to copy from the dsp module demo example. However, I need my filter to process sample by sample so I am trying to use the processSample method. When I do this it doesn’t do any filtering! Would anyone be able to guide me into setting this up pelase?
You also need to set the coefficients in the prepareToPlay. I don’t believe that in the constructor you already have the sample rate value available. This was a headache for me a few months ago.
I need to use the setCoefficients() method to set the coefficients right?
First I have to do this to generate the coefficients. Then I pass this into setCoefficients?
lpfLpointer = dsp::IIR::Coefficients::makeFirstOrderLowPass (getSampleRate(), 5000 );
In the reference guide, the following is given
’void IIRFilter::setCoefficients ( const IIRCoefficients & newCoefficients )’
How do I apply this method to my lowPassFilterL filter?
Take a look at: https://juce.com/doc/classdsp_1_1IIR_1_1Filter
As you can see, the filters you use have a public attribute called coefficients. You can simply replace this pointer with the one you get with dsp::IIR::Coefficients::makeFirstOrderLowPass (getSampleRate(), 5000 );
So in theory if I move my slider it should change the filtering? However it doens’t seem to do anything? Is there something else I need to do? Something I’ve missed? Or have I just implemented this wrong?
quick guess: try to dereference both sides: *lowPassFilterL.coefficients = *dsp::IIR::Coefficients<float>::makeFirstOrderLowPass (getSampleRate(), lpfValue );
can’t test it right now
myfiltername.get doesn’t seem to be a valid method?
and also if I try…
myfiltername.state = *NewCoefficients;
I got the following errors:
‘state’ is a private member of ‘juce::dsp::IIR::Filter’
Assigning to ‘float *’ from incompatible type ‘ReferencedType’ (aka ‘juce::dsp::IIR::Coefficients’)
Btw I am not using processorduplicator, I have created two mono filters. I need to do sample by sample processing and when you use precessorduplicator you can’t do that. https://juce.com/doc/structdsp_1_1ProcessorDuplicator