High pass / low pass / band pass / band cut filter

Share your Audacity/Nyquist plug-ins here, or test drive the latest plug-ins submitted by Audacity users.

After testing a plug-in from this forum, please post feedback for the plug-in author.
Post Reply
steve
Site Admin
Posts: 47595
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu
Contact:

High pass / low pass / band pass / band cut filter

Post by steve » Mon Jan 28, 2013 3:50 am

This is a filter plug-in that can perform high pass, low pass, band pass and band stop filtering.

Controls:
  • Filter type: [High Pass, Low Pass, Band Pass, Band Cut. Default High Pass]
    • High Pass Filter passes frequencies above its cutoff frequency and attenuates frequencies below its cutoff frequency. This effect can therefore be used to reduce low frequency noise.
    • Low Pass Filter passes frequencies below its cutoff frequency and attenuates frequencies above its cutoff frequency. This effect can therefore be used to reduce high pitched noise.
    • Band Pass filter passes frequencies within the specified frequency range and attenuates frequencies below and above this frequency band.
    • Band Cut Filter attenuates frequencies within the specified frequency range and passes frequencies below and above this frequency band.
  • Rolloff (dB per octave): [6 dB, 12 dB, 24 dB, 36 dB, 48 dB. Default 6 dB]
    Sets the steepness of the attenuation. Higher rolloff values give a steeper attenuation of frequencies above the cutoff frequency. For example, with a rolloff of 6 dB per octave, the sound decreases by 6 dB in amplitude for each octave above the cutoff frequency (an octave above is double the frequency)
  • Frequency (Hz): [1 to 20000 Hz. Default 1000]
    For high pass and low pass filters, this is the -3 dB corner frequency. For band pass and band cut filters this is the centre frequency.
  • Band filter width (Hz): [1 to 10000 Hz. Default 1000 Hz]
    This applies only to band pass and band cut filters and is the width of the filter frequency band.
  • Crossfade filter in/out (ms): [0 to 100 milliseconds. Default 0]
    When set greater than 0, the processed sound will be introduced with a short crossfade from the original audio at the beginning and end of the selection. This control sets the length of the crossfade.

Installation instructions:
http://wiki.audacityteam.org/wiki/Downl ... g_Plug-ins

After installation and restarting Audacity the effect will appear in the Effect menu and is called "Filter..."


The "Crossfade filter in/out" control:

When applying a filter to a section of audio, there is likely to be a "glitch" (pop) occur at the start / end of the selection unless the selection can be made such that the waveform is close to silence at the start/end of the selection. Sometimes it is not possible or not practical to make the selection start and end close to silence and this is the purpose of the "Crossfade filter in/out" feature. If this control is set greater than zero, there will be a short crossfade automatically applied at the start and end of the selection, thus avoiding clicks at the start or end. A setting of around 20 milliseconds is usually sufficient to avoid clicks.

If required for a special effect, the crossfade duration may be set longer than 100 ms by typing the required value in the text box. The crossfade duration cannot be more than half of the length of the selection.


Filter frequency range:

Filter frequencies cannot be greater than half the sample rate. Note that for a band pass or band cut filter the filter frequency will be higher than the "centre frequency". for example, for a centre frequency of 10000 Hz (10 kHz) and a band-width of 15000 Hz (15 kHz) the audio will be filtered between 500 Hz and 20000 Hz (10000 Hz is the centre of this range on a logarithmic scale).
Attachments
filter.ny
(2.91 KiB) Downloaded 1505 times
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

kozikowski
Forum Staff
Posts: 40710
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: OS X 10.9 Mavericks
Location: Los Angeles

Re: High pass / low pass / band pass / band cut filter

Post by kozikowski » Mon Jan 28, 2013 5:26 am

You appear to have left out the All Cut filter, although I suppose you could get there with appropriate values of High Pass and Low Pass. Does Band Cut go to infinite bandwidth? Koz

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

Re: High pass / low pass / band pass / band cut filter

Post by steve » Mon Jan 28, 2013 5:31 am

kozikowski wrote:You appear to have left out the All Cut filter
That's the secret hidden function. Press Ctrl+L (Command+L)
kozikowski wrote:Does Band Cut go to infinite bandwidth?
No. See the note "Filter frequency range:" in my previous post.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Robert J. H.
Posts: 1816
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 10

Re: High pass / low pass / band pass / band cut filter

Post by Robert J. H. » Mon Jan 28, 2013 6:03 am

If you're interested, here are the (Q-)values for lowpass10 (-60dB/octave). It follows the conventions of the predefined Nyquist functions. The values apply equally to Highpass10 when lowpass2 is replaced by highpass2.

Code: Select all

(defun lowpass10 (x hz)
  (lowpass2 (lowpass2 (lowpass2 (lowpass2 (lowpass2 x 
            hz 3.1969) 
          hz 1.1013) 
        hz 0.7071) 
      hz 0.5612) 
    hz 0.5062))
It would be nice when the odd ordered filters would also be included (lowpass3 ... lowpass9) for roll-offs of 18 dB, 30 dB ... 54 dB.

fred_gaou
Posts: 3
Joined: Sun Feb 09, 2014 9:33 pm
Operating System: Please select

Re: High pass / low pass / band pass / band cut filter

Post by fred_gaou » Sun Feb 09, 2014 10:07 pm

Hi,

The band-cut have no effect on my track or selection.

Tested with those settings:
Image
(I tweaked the settings with no success.)

to cut this frequency peak:
Image

However, the band-pass works with the same settings.

I know there are other plugins to do that but I love all the options, especially the Band filter width (Hz) option instead of being octave or Q.

Please could you fix it.

config: windows xp sp3, audacity 2.0.5

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

Re: High pass / low pass / band pass / band cut filter

Post by steve » Mon Feb 10, 2014 12:01 am

The frequency band that you are attempting to produce is too narrow for this type of filter. You need to use a "notch filter" to achieve such a narrow stop band. There is a notch filter included in Audacity. http://manual.audacityteam.org/o/man/notch_filter.html

This type of filter can be expected to work down to around 1/4 octave stop band width, which for a centre frequency of 6450 Hz is a bit over 1000 Hz.
As a rough guide, to calculate the minimum width that will work for the 48 dB per octave band stop filter, multiply the centre frequency by 0.18.
6450 x 0.18 = 1161 Hz
That will give you around 6dB attenuation at the centre frequency.

There is another band-stop filter available here: http://wiki.audacityteam.org/wiki/Nyqui ... top_Filter
In this filter, the band width is specified in octaves. The minimum width is again 1/4 octave, but it will produce a much steeper roll-off, thus the attenuation within the frequency band is very much greater than for the "High pass / low pass / band pass / band cut filter".
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

fred_gaou
Posts: 3
Joined: Sun Feb 09, 2014 9:33 pm
Operating System: Please select

Re: High pass / low pass / band pass / band cut filter

Post by fred_gaou » Mon Feb 10, 2014 12:17 am

Thanks for your explanation.

I have good result with the notch filter but I hoped there were a more user friendly plugin to cut off a frequency or a narrow range that will simply allow user to enter the range in frequency (not octave or Q ratio).

Ex 1:
lower cutoff frequency = ...
upper cutoff frequency = ...
or

EX 2:
center frequency = ...
band filter width (Hz) = ...
Do you think it is just impossible to write a such plugin for audacity?

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

Re: High pass / low pass / band pass / band cut filter

Post by steve » Mon Feb 10, 2014 5:39 am

fred_gaou wrote:Do you think it is just impossible to write a such plugin for audacity?
The problem is in defining filters in a meaningful way.

Frequency filters are not "on/off" things. There is always a transition between the "pass" range and the "stop" range. Different types of filter have different characteristics, and are usually described in terms that are appropriate for the characteristics.

For the "High pass / low pass / band pass / band cut filter" it is reasonable to define the pass band or stop band as an upper and lower frequency value because they are simply a high pass filter and a low pass filter combined. High pass and low pass filters are generally defined in terms of the -3dB point (the "corner frequency) and the "slope" of the filter (how many dB attenuation per octave beyond the corner frequency). This is only really appropriate if the slope is fairly linear (a constant number of dB per octave). For "Notch filters" that is not the case. Typically Notch filters have an increasing slope approaching the centre frequency, thus they are generally defined in terms of centre frequency and "q". Specifying the "slope" of a notch filter is meaningless because it depend on what part of the transition curve is being measured.

This is a notch filter with a centre frequency of 1000 Hz, q = 0.5
Do you see the difficulty in specifying the lower and upper frequency limits?
notch.png
notch.png (38.45 KiB) Viewed 17194 times
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

fred_gaou
Posts: 3
Joined: Sun Feb 09, 2014 9:33 pm
Operating System: Please select

Re: High pass / low pass / band pass / band cut filter

Post by fred_gaou » Mon Feb 10, 2014 6:01 am

Yes but it would be more meaningful for common users to set the range to cut off (slope being automatically calculated according to it) in frequency range. Plus the more the frequency to cut off is high, the more a same given Q ratio apply a wider cut off. So it can be hard to precisely cut off a high frequency in the rare cases when high-cut can't be used.

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

Re: High pass / low pass / band pass / band cut filter

Post by steve » Mon Feb 10, 2014 6:10 am

fred_gaou wrote:Yes but it would be more meaningful for common users to set the range to cut off (slope being automatically calculated according to it) in frequency range. Plus the more the frequency to cut off is high, the more a same given Q ratio apply a wider cut off. So it can be hard to precisely cut off a high frequency in the rare cases when high-cut can't be used.
Sorry, I've read that 3 times and I still don't understand what you are saying.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply