1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-01-13 08:05:52 +01:00

Fix for bug 1151

Extend available frequency range for Nyquist filter plug-ins.
This commit is contained in:
Steve Daulton
2015-08-19 15:25:55 +01:00
parent b5103a6a8d
commit 71b3f37434
3 changed files with 69 additions and 57 deletions

View File

@@ -1,26 +1,37 @@
;nyquist plug-in
;version 1
;version 4
;type process
;preview linear
;categories "http://lv2plug.in/ns/lv2core/#FilterPlugin"
;name "Notch Filter..."
;action "Performing Notch Filter..."
;action "Applying Notch Filter..."
;author "Steve Daulton and Bill Wharrie"
;copyright "Released under terms of the GNU General Public License version 2"
;control freq "Frequency" real "Hz" 60 0 10000
;control q "Q (higher value reduces width)" real "" 1 0.1 20
;; notch.ny by Steve Daulton and Bill Wharrie, September 2010.
;; Last updated August 2015.
;; Released under terms of the GNU General Public License version 2:
;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html .
;; (multichan-expand) provides legacy support for old versions of Audacity
;; in which the (notch2) function only supports mono tracks.
;control range "Frequency range" choice "Hz,kHz" 0
;control frequency "Frequency" real "" 60 1 1000
;control q "Q (higher value reduces width)" real "" 1 0.1 20
(cond
((> freq (/ *sound-srate* 2.0))(format nil "Error:\nFrequency too high for track sample rate."))
((< freq 0)(format nil "Error:\nNegative frequency is invalid."))
((< q 0.01)(format nil "Error:\nWidth must be at least 0.01."))
((= freq 0) (format nil "Nothing to be done."))
(T (multichan-expand #'notch2 s freq q)))
(case range
(0 (setf f0 (format nil "~a Hz" frequency))
(setf srate (format nil "~a Hz" *sound-srate*))
(setf fmax (format nil "~a Hz" (/ *sound-srate* 2))))
(T (setf f0 (format nil "~a kHz" frequency))
(setf frequency (* frequency 1000))
(setf srate (format nil "~a kHz" (/ *sound-srate* 1000)))
(setf fmax (format nil "~a kHz" (/ *sound-srate* 2000)))))
(if (>= frequency (/ *sound-srate* 2.0))
(format nil "Error:\nFrequency (~a) too high for track sample rate.~%~%~
Track sample rate is ~a~%~
Frequency must be less than ~a."
f0
srate
fmax)
(notch2 *track* frequency q))