Implementing an official All Pass · Issue #78 · processing/processing-sound (original) (raw)

Hello.

According to the documentation there is not an official AllPass filter for processing-sound available to the user.
There does appear to be some code for one in the source from 2018 used to implement other effects.

If we are interesting in creating one, I think it should be based on this object from jsyn.
http://www.softsynth.com/jsyn/docs/javadocs/com/jsyn/unitgen/FilterOnePoleOneZero.html

Using the already implemented lowpass filter as a guide, I propose something like the below.

package processing.sound;

import com.jsyn.unitgen.FilterOnePoleOneZero;

import processing.core.PApplet;

public class AllPass extends Effect {

public AllPass(PApplet parent) {
    super(parent);
    //init some reasonable values for a0, a1, b1.
}

@Override
protected FilterOnePoleOneZero newInstance() {
    return new FilterOnePoleOneZero();
}

public void coeffs(float inputCoeff, float delayedInputCoeff, float delayedOutputCoeff) {
    //Some safety checks to ensure inputs are in a reasonable range.
    this.left.a0.set(inputCoeff);
    this.left.a1.set(delayedInputCoeff);
    this.left.b1.set(delayedOutputCoeff);
}

public void process(SoundObject input, float a0, float a1, float b1) {
    this.coeffs(a0, a1, b1);
    this.process(input);
}

}

Would the processing-sound team be interested in an allpass filter for processing-sound?

Thank you for your time and I'm looking forward to hearing from you.
Warm Regards, PixMusix.