Filters

Feedback and Reviews for Audacity 2.x
Forum rules
This board is ONLY for general feedback and discussion about Audacity 2.X.

If you require help, or think you have found a "bug", please post on the forum board relevant to your operating system.
Windows
Mac OS X
GNU/Linux and Unix-like
Post Reply
prko
Posts: 4
Joined: Wed Feb 28, 2018 12:59 am
Operating System: Windows 10

Filters

Post by prko » Fri Apr 06, 2018 4:26 am

Hi,

Are the following filters Butterworth filters?

https://manual.audacityteam.org/man/low ... ilter.html

https://manual.audacityteam.org/man/hig ... ilter.html

https://manual.audacityteam.org/man/notch_filter.html

The descriptions for the LPF and the HPF seem to be so, but there are no mentions of the filter algorithms.

How about the notch filter?

Best,
Prko

steve
Site Admin
Posts: 48712
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Filters

Post by steve » Fri Apr 06, 2018 10:51 am

The low pass and high pass filters are Butterworth filters.
The notch filter is second-order IIR (biquad) notch filter.

Nyquist plug-ins are text files which have a ".ny" file name extension (rather than ".txt"). They can be opened and viewed in a plain text editor (such as NotePad++) to reveal the Nyquist code. For example, this is the code of the Notch filter in Audacity 2.2.2:

Code: Select all

;nyquist plug-in
;version 4
;type process
;preview linear
;name "Notch Filter..."
;manpage "Notch_Filter"
;debugbutton false
;action "Applying Notch Filter..."
;author "Steve Daulton and Bill Wharrie"
;copyright "Released under terms of the GNU General Public License version 2"

;; notch.ny by Steve Daulton and Bill Wharrie
;; Released under terms of the GNU General Public License version 2:
;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html .


;control frequency "Frequency (Hz)" float-text "" 60 0 nil
;control q "Q (higher value reduces width)" float-text "" 1 0.1 1000

(cond
  ((< frequency 0.1) "Frequency must be at least 0.1 Hz.")
  ((>= frequency (/ *sound-srate* 2.0))
    (format nil "Error:~%~%Frequency (~a Hz) is too high for track sample rate.~%~%~
                 Track sample rate is ~a Hz.~%~
                 Frequency must be less than ~a Hz."
            frequency
            *sound-srate*
            (/ *sound-srate* 2.0)))
  (T  (notch2 *track* frequency q)))
Lines beginning with a semicolon are seen by the Nyquist interpreter as "comments" and ignored (though the comments at the top of the file are special "header" comments that are used by Audacity to create the plug-in UI (user interface). So the Nyquist code is just:

Code: Select all

(cond
  ((< frequency 0.1) "Frequency must be at least 0.1 Hz.")
  ((>= frequency (/ *sound-srate* 2.0))
    (format nil "Error:~%~%Frequency (~a Hz) is too high for track sample rate.~%~%~
                 Track sample rate is ~a Hz.~%~
                 Frequency must be less than ~a Hz."
            frequency
            *sound-srate*
            (/ *sound-srate* 2.0)))
  (T  (notch2 *track* frequency q)))
Most of this code is just to check that the user supplied values lie within the usable range of 0.1 Hz to half the sample rate. If these tests pass, then the final command runs:

Code: Select all

 (notch2 *track* frequency q)
where:
notch2 is a built-in Nyquist function
*track* is the audio passed by Audacity to the plug-in (the selected audio)
frequency and q are values from the interface controls.

The Nyquist function is described in the Nyquist manual here: http://www.audacity-forum.de/download/e ... l#index345
(notch2 signal hz [q])
A fixed-parameter, second-order notch filter based on snd-biquad. The center frequency is given by hz (a FLONUM) and an optional Q factor is given by q (a FLONUM).
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

prko
Posts: 4
Joined: Wed Feb 28, 2018 12:59 am
Operating System: Windows 10

Re: Filters

Post by prko » Sat Apr 07, 2018 8:46 am

Thank you for the kind answer!

Post Reply