Sometimes it is desirable to filter out a narrow frequency, but the usual notch filter (notch2 s Hz Q) is just too deep. The idea of this filter is to provide the narrow band of a notch filter, but to limit the depth of the notch by mixing in a proportion of the unfiltered audio.
Here’s the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
;; depth limited notch filter (setq freq 3670) ; notch frequency (setq db -12) ; reduction in dB (setq Q 1.0) ; Q of the notch filter (setq db (db-to-linear db)) ;(print db) (if (arrayp s) (vector (sim (mult (- 1.0 db) (notch2 (aref s 0) freq Q))(mult db (aref s 0))) (sim (mult (- 1.0 db) (notch2 (aref s 1) freq Q))(mult db (aref s 1)))) (sim (mult (- 1.0 db) (notch2 s freq Q))(mult db s))) |
In theory there’s lots of nasty phase shifting going on, but in practice it seems to work pretty well.
interesting stuff , purely for intellectual purposes only.