Hi, Alik. Other people will be able to give you a more exhaustive answer but it might be caused by quantisation of the coefficients making the filter a bit unstable. Are you working in double precision?
Even in single precision, the biquad filter <https://webaudio.github.io/Audio-EQ-Cookbook/audio-eq-cookbook.html> below seems to be more stable, although it may be computationally more expensive. Ciao, Dario declare name "nstest"; import("stdfaust.lib"); fb = hslider("feedback",0,-1,1,0.001); process(x,y) = x,y : (+ : ef.cubicnl_nodc(drive, offsetL)) ~ * (fb), (+ : ef.cubicnl(drive, offsetR)) ~ * (fb) //: fi.highpass(2, HPFfreq), fi.highpass(2,HPFfreq) with{ : highpass(HPFfreq), highpass(HPFfreq) with{ HPFfreq = hslider("HPF freq",50, 20,10000,0.01): si.smoo; drive = hslider("drive",0,0,1,0.001); offsetL = hslider("offsetL",0,-1,1,0.001); offsetR = hslider("offsetR",0,-1,1,0.001); } ; highpass(cf, in) = biquad(a0, a1, a2, b1, b2, in) with { q1 = .707; alpha = sin(w(cf)) / (2 * q1); norm = 1 + alpha; a0 = ((1 + cos(w(cf))) / 2) / norm; a1 = -1 * (1 + cos(w(cf))) / norm; a2 = ((1 + cos(w(cf))) / 2) / norm; b1 = cos(w(cf)) * -2 / norm; b2 = (1 - alpha) / norm; w(f) = 2 * ma.PI * f / ma.SR; biquad(a0, a1, a2, b1, b2, x) = fir : + ~ iir with { fir = a0 * x + a1 * x' + a2 * x''; iir(fb) = -b1 * fb - b2 * fb'; }; }; On Fri, 18 Dec 2020 at 07:14, Alik Rustamoff <alikthen...@gmail.com> wrote: > Hi, > > when I use fi.highpass in the following example I get weird noise at the > output if when offset parameters are not 0 and fighpass frequency is less > than 70hz. Removing the highpass filter of raising cutoff freq removes the > noise. Should it be like that? what is the reason? > > > declare name "nstest"; > > import("stdfaust.lib"); > > > fb = hslider("feedback",0,-1,1,0.001); > > > process(x,y) = x,y : (+ : ef.cubicnl_nodc(drive, offsetL)) ~ * (fb), (+ : > ef.cubicnl(drive, offsetR)) ~ * (fb) > > : fi.highpass(2, HPFfreq), fi.highpass(2,HPFfreq) with{ > > > HPFfreq = hslider("HPF freq",50, 20,10000,0.01): si.smoo; > > drive = hslider("drive",0,0,1,0.001); > > offsetL = hslider("offsetL",0,-1,1,0.001); > > offsetR = hslider("offsetR",0,-1,1,0.001); > > } ; > > > _______________________________________________ > Faudiostream-users mailing list > Faudiostream-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/faudiostream-users > -- Dr Dario Sanfilippo http://dariosanfilippo.com
_______________________________________________ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users