Nyquist code for "gradual" high-pass filter please

Exponential works better IMO.

BTW using “find” hp, “replace” with lp on the above code gives the same effect as Steve’s 2011 code, but now with a smoother envelope …


Low-pass variant of above code …

    (setq start-freq 22000) ; cannot be greater than 1/2 the sample rate
    (setq end-freq 20)
    (setq passes 1)         ; more passes for a steeper filter cut-off
    (setq sweep-type 0)     ; 1 for a linear sweep, 0 for exponential sweep

    (let* ((nyq (/ *sound-srate* 2.0))
           (f0 (max 0 (min nyq start-freq)))
           (f1 (max 0 (min nyq end-freq))))
      (if (= sweep-type 0)
          (setf lpfreq (pwev f0 1 f1))
          (setf lpfreq (pwlv f0 1 f1)))
      (dotimes (i passes s)
        (setf s (lp s lpfreq))))