I now made a version where cutoff and resonance are signals. This version is a bit more CPU intensive now, as some computations had to move into the DSP loop to react to the changes in center frequency.
Awesome! To my ears it sounds great - very close to the Csound-version.
I played a bit with a rational tanh approximation from the music-dsp list but it didn't sound good anymore. If someone wants to play with other approximations e.g. table lookup: Just change the function "mytanh".
Some optimizations are needed for reducing cpu load, true, I'll look into it.
The filter response gets nasty and loud if the center frequency is near or above the sampling rate. Maybe it should be restricted as well. But then, resonance at 1 will make everyone jump, too...
Yeah I noticed that aswell. I think the Csound-version has cutoff restricted to 0...1, which is 0...11050 in hertz.
Thanks again.
/Anton
Hallo, Anton H?rnquist hat gesagt: // Anton H?rnquist wrote:
The filter response gets nasty and loud if the center frequency is near or above the sampling rate. Maybe it should be restricted as well. But then, resonance at 1 will make everyone jump, too...
Yeah I noticed that aswell. I think the Csound-version has cutoff restricted to 0...1, which is 0...11050 in hertz.
Only resonance is restricted to 0 and 1. It is in the pd version as well. I made some tests now and it seems it's not the cutoff frequency alone that makes the filter run wild. With resonance set to 0 a cutoff of 96kHz when running at SR = 48kHz doesn't go wild. But set resonance to 0.1 and it runs away.
So in the end I'd say, just be careful and if in doubt [clip~] your input values.
Another issue may be denormalization, so some PD_BIG_OR_SMALL checks could be useful.
Frank Barknecht