ofxMaxim – audio output fails when applying low-pass or high-pass filter

Hey everyone.

I’m grappling with an error that happens when I apply a low-pass or high-pass filter with resonance in ofxMaxim. At a certain ‘threshold’ the sounds simply cuts off and can not be recovered. While it is still possible to use other filter methods, the method that fails once does not yield any output after the ‘threshold’ is surpassed once.

To be more precise, the error happens in the audioOut() method here:

sample = m_sample.play();

if (m_param_enable_resonance) {
    // the error happens in this block
    sample = m_filter_lp.lores(sample, m_param_lpr_cutoff, m_param_lpr_resonance);
    sample = m_filter_hp.hires(sample, m_param_hpr_cutoff, m_param_hpr_resonance);
} else {
    sample = m_filter_lp.lopass(sample, m_param_lp_cutoff);
    sample = m_filter_hp.hipass(sample, m_param_hp_cutoff);
}

The frequency cutoff variables m_param_lpr_cutoff and m_param_hpr_cutoff are of type ofParameter<double> with a range between 10.0 and 44100.0 (the sample rate). These values I took from the source code of the maximilian filter function.

//awesome. cuttof is freq in hz. res is between 1 and whatever. Watch out!
double maxiFilter::lores(double input, double cutoff1, double resonance) {
	cutoff=cutoff1;
	if (cutoff<10) cutoff=10;
	if (cutoff>(maxiSettings::sampleRate)) cutoff=(maxiSettings::sampleRate);
	if (resonance<1.) resonance = 1.;
	//...
}

In the case of the value for m_param_lpr_cutoff my sound fails around 10000 (Hz). I like the comment Watch out!, but the question now is, what should I watch out for? :wink:

The code for my example can e found here: https://github.com/davidbeermann/ofxMaxim-examples/tree/master/LowHighPassFiltering

Thanks.
David