public class HighPassFilter extends FIRFilter
FIRFilter.FIROutput
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_TRANSITIONBANDWIDTH |
double |
normalisedCutoffFrequency |
denumeratorCoefficients, impulseResponseLength, sliceLength, transformedIR
Constructor and Description |
---|
HighPassFilter(double normalisedCutoffFrequencyIn)
Create a new highpass filter with the given normalized cutoff frequency and a default transition band width.
|
HighPassFilter(double normalisedCutoffFrequencyIn,
double normalisedTransitionBandwidth)
Create a new highpass filter with the given normalized cutoff frequency and the given normalized transition band width.
|
HighPassFilter(double normalisedCutoffFrequencyIn,
int kernelLength)
Create a new highpass filter with the given normalized cutoff frequency and the given length of the filter kernel.
|
Modifier and Type | Method and Description |
---|---|
protected static int |
bandwidth2kernelLength(double normalisedTransitionBandwidth)
Convert from normalisedTransitionBandwidth to filter kernel length, using the approximate formula l = 4/bw.
|
protected static double[] |
getKernel(double normalisedCutoffFrequencyIn,
int kernelLength)
Compute the high-pass filter kernel, as a spectrally inverted low-pass filter kernel.
|
double |
getTransitionBandWidth(int samplingRate)
For a given sampling rate, return the width of the transition band for this filter, in Hertz.
|
protected static double |
kernelLength2bandwidth(int kernelLength)
Convert from filter kernel length to normalisedTransitionBandwidth, using the approximate formula l = 4/bw.
|
static void |
main(String[] args) |
String |
toString() |
apply, apply, applyInline, getDenumeratorCoefficients, getImpulseResponseLength, initialise
public static double DEFAULT_TRANSITIONBANDWIDTH
public double normalisedCutoffFrequency
public HighPassFilter(double normalisedCutoffFrequencyIn)
normalisedCutoffFrequencyIn
- the cutoff frequency of the highpass filter, expressed as a fraction of the sampling rate. It must be in the
range ]0, 0.5[. For example, with a sampling rate of 16000 Hz and a desired cutoff frequency of 4000 Hz, the
normalisedCutoffFrequency would have to be 0.25.public HighPassFilter(double normalisedCutoffFrequencyIn, double normalisedTransitionBandwidth)
normalisedCutoffFrequencyIn
- the cutoff frequency of the highpass filter, expressed as a fraction of the sampling rate. It must be in the
range ]0, 0.5[. For example, with a sampling rate of 16000 Hz and a desired cutoff frequency of 4000 Hz, the
normalisedCutoffFrequency would have to be 0.25.normalisedTransitionBandwidth
- indicates the desired quality of the filter. The smaller the bandwidth, the more abrupt the cutoff at the cutoff
frequency, but also the larger the filter kernel (impulse response) and computationally costly the filter. Usual
range of this parameter is [0.002, 0.2].public HighPassFilter(double normalisedCutoffFrequencyIn, int kernelLength)
normalisedCutoffFrequencyIn
- the cutoff frequency of the highpass filter, expressed as a fraction of the sampling rate. It must be in the
range ]0, 0.5[. For example, with a sampling rate of 16000 Hz and a desired cutoff frequency of 4000 Hz, the
normalisedCutoffFrequency would have to be 0.25.kernelLength
- length of the filter kernel (the impulse response). The kernel length must be an odd number. The longer the
kernel, the sharper the cutoff, i.e. the narrower the transition band. Typical lengths are in the range of
10-1000.IllegalArgumentException
- if the kernel length is not a positive, odd number, or if normalisedCutoffFrequency is not in the range between
0 and 0.5.public double getTransitionBandWidth(int samplingRate)
samplingRate
- the sampling rate, in Hertz.protected static double[] getKernel(double normalisedCutoffFrequencyIn, int kernelLength)
normalisedCutoffFrequencyIn
- normalizedCutoffFrequencyInkernelLength
- kernelLengthprotected static int bandwidth2kernelLength(double normalisedTransitionBandwidth)
normalisedTransitionBandwidth
- normalisedTransitionBandwidthprotected static double kernelLength2bandwidth(int kernelLength)
kernelLength
- kernelLengthCopyright © 2000–2016 DFKI GmbH. All rights reserved.