How to use multiple SuperpoweredFilter types in a singular audiosystem (SuperpoweredAudioIO)

107 Views Asked by At

About the SuperpoweredFilter (being an analogue filter). Is it possible to have two instances for highpass and lowpass filter types in one audio system (SuperpoweredAudioIO)? Because I have tried different methods but the last filter type's instance declared only gets audible at runtime. Please help

This is my declaration of both instances;

filter = new SuperpoweredFilter(SuperpoweredFilter_Resonant_Highpass, samplerate);
filterb = new SuperpoweredFilter(SuperpoweredFilter_Resonant_Lowpass, samplerate);


audioSystem = new SuperpoweredAndroidAudioIO(samplerate, buffersize, false, true, audioProcessing, this, -1, SL_ANDROID_STREAM_MEDIA, buffersize * 2);

           filterb->setResonantParameters(floatToFrequency(1.0f), 0.2f);
           filter->setResonantParameters(floatToFrequency(1.0f), 0.2f);              //resonance
           filterb->enable(true);
           filter->enable(true);

       playerA->play(false);

Also in the audioprocessing method, I called

filterb->process(stereoBuffer, stereoBuffer, numberOfSamples);  
filter->process(stereoBuffer, stereoBuffer, numberOfSamples); 
1

There are 1 best solutions below

2
On

It's not clear What you mean with

only gets audible at runtime

Do you call

filterb->process(stereoBuffer, stereoBuffer, numberOfSamples);  
filter->process(stereoBuffer, stereoBuffer, numberOfSamples);  

in the main "process" method?

Using the above calling sequence, however, if you set both filters Fc to 1.0 (that is 20kHz) you will have a situation like:
Lowpass-> block all frequencies above 20kHz (i.e.: no audible effect)
then
Highpass-> block all frequencies below 20kHz (i.e.: total frequencies cut off)
so you'll have almost no signal in output!
Did you try to change the Fc dynamically?