Fade from bass to normal

I have messed around with this code, but I can’t figure out how to change it from bass to normal, instead of treble to bass. If you know please let me know.

;version 3
(setq start-freq 10000) ; cannot be greater than 1/2 the sample rate
(setq end-freq 100)
(setq passes 4)         ; 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 hpfreq (pwev f0 1 f1))
      (setf hpfreq (pwlv f0 1 f1)))
  (dotimes (i passes s)
    (setf s (hp s hpfreq))))

change [red] “hp” in the last line to “lp”.

[ optional: change start-freq to 100, change end-freq to 10000 ].

1 Like

Trebor is absolutely correct.
As we are writing new code we should also update it to the latest ;version 4 syntax, which just mean changing the version line at the top, and changing the “S” variables to *track*:

;version 4
(setq start-freq 100)
(setq end-freq 10000) ; cannot be greater than 1/2 the sample rate
(setq passes 4)       ; 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 hpfreq (pwev f0 1 f1))
      (setf hpfreq (pwlv f0 1 f1)))
  (dotimes (i passes *track*)
    (setf *track* (lp *track* hpfreq))))

1 Like

Thanks a lot guys

This topic was automatically closed after 30 days. New replies are no longer allowed.