SAF
Loading...
Searching...
No Matches
saf_utility_filters.h File Reference

A collection of IIR/FIR filter and filterbank designs. More...

#include "saf_utilities.h"

Go to the source code of this file.

Enumerations

enum  BIQUAD_FILTER_TYPES {
  BIQUAD_FILTER_LPF , BIQUAD_FILTER_LPF_EQCB , BIQUAD_FILTER_HPF , BIQUAD_FILTER_HPF_EQCB ,
  BIQUAD_FILTER_PEAK , BIQUAD_FILTER_PEAK_EQCB , BIQUAD_FILTER_LOW_SHELF , BIQUAD_FILTER_LOW_SHELF_EQCB ,
  BIQUAD_FILTER_HI_SHELF , BIQUAD_FILTER_HI_SHELF_EQCB
}
 Bi-quadratic (second-order) IIR filter design options. More...
 
enum  BUTTER_FILTER_TYPES { BUTTER_FILTER_LPF , BUTTER_FILTER_HPF , BUTTER_FILTER_BPF , BUTTER_FILTER_BSF }
 Butterworth Infinite Impulse Response (IIR) filter design options. More...
 
enum  FIR_FILTER_TYPES { FIR_FILTER_LPF , FIR_FILTER_HPF , FIR_FILTER_BPF , FIR_FILTER_BSF }
 Finite Impulse Response (FIR) filter design options. More...
 
enum  WINDOWING_FUNCTION_TYPES {
  WINDOWING_FUNCTION_RECTANGULAR , WINDOWING_FUNCTION_HAMMING , WINDOWING_FUNCTION_HANN , WINDOWING_FUNCTION_BARTLETT ,
  WINDOWING_FUNCTION_BLACKMAN , WINDOWING_FUNCTION_NUTTALL , WINDOWING_FUNCTION_BLACKMAN_NUTTALL , WINDOWING_FUNCTION_BLACKMAN_HARRIS
}
 Windowing function types. More...
 

Functions

void getWindowingFunction (WINDOWING_FUNCTION_TYPES type, int winlength, float *win)
 Computes the weights of a specific windowing function.
 
void getOctaveBandCutoffFreqs (float *centreFreqs, int nCentreFreqs, float *cutoffFreqs)
 Converts octave band CENTRE frequencies into CUTOFF frequencies.
 
void flattenMinphase (float *x, int len)
 Equalises input sequence by its minimum phase form, in order to bring its magnitude response to unity, as described in [1].
 
void interpolateFiltersH (int inFFTsize, int outFFTsize, int nFilters, float_complex *filters_in, float_complex *filters_out)
 Interpolate filters (w.r.t.
 
float convertBW2Q (float BW)
 Converts filter octave band-width to Q-factor.
 
float convertQ2BW (float Q)
 Converts filter Q-factor to octave band-width.
 
void biQuadCoeffs (BIQUAD_FILTER_TYPES filterType, float fc, float fs, float Q, float gain_dB, float b[3], float a[3])
 Calculates 2nd order IIR filter coefficients [1].
 
void applyBiQuadFilter (float b[3], float a[3], float w_z_12[2], float *signal, int nSamples)
 Applies biQuad filter to an input signal using the direct form II difference equation: https://en.wikipedia.org/wiki/Digital_biquad_filter.
 
void evalBiQuadTransferFunction (float b[3], float a[3], float *freqs, int nFreqs, float fs, int mag2dB, float *magnitude, float *phase_rad)
 Evaluates the 2nd order IIR transfer function at one or more frequencies, returning its magnitude and/or phase response.
 
void evalIIRTransferFunction (double *b, double *a, int nCoeffs, float *freqs, int nFreqs, float fs, int mag2dB, float *magnitude, float *phase_rad)
 Computes magnitude and phase response of an IIR filter from its coefficients at user-specified frequencies (Hz).
 
void evalIIRTransferFunctionf (float *b, float *a, int nCoeffs, float *freqs, int nFreqs, float fs, int mag2dB, float *magnitude, float *phase_rad)
 Computes magnitude and phase response of an IIR filter from its coefficients (floats) at user-specified frequencies (Hz).
 
void applyIIR (float *in_signal, int nSamples, int nCoeffs, float *b, float *a, float *wz, float *out_signal)
 Applies an IIR filter to a time-domain signal (using the direct form II difference equation)
 
void butterCoeffs (BUTTER_FILTER_TYPES filterType, int order, float cutoff1, float cutoff2, float sampleRate, double *b_coeffs, double *a_coeffs)
 Computes Butterworth IIR filter coefficients [1].
 
void faf_IIRFilterbank_create (void **phFaF, int order, float *fc, int nCutoffFreqs, float sampleRate, int maxNumSamples)
 Computes a bank of IIR filter coefficients required to divide a signal into frequency bands, based on the design by Favrot & Faller [1].
 
void faf_IIRFilterbank_apply (void *hFaF, float *inSig, float **outBands, int nSamples)
 Applies the Favrot & Faller filterbank.
 
void faf_IIRFilterbank_flushBuffers (void *hFaF)
 Zeros the delay lines used during faf_IIRFilterbank_apply()
 
void faf_IIRFilterbank_destroy (void **hFaF)
 Destroys an instance of the Favrot & Faller filterbank.
 
void FIRCoeffs (FIR_FILTER_TYPES filterType, int order, float cutoff1, float cutoff2, float sampleRate, WINDOWING_FUNCTION_TYPES windowType, int scalingFLAG, float *filter)
 Computes FIR filter coefficients by windowing.
 
void FIRFilterbank (int order, float *fc, int nCutoffFreqs, float sampleRate, WINDOWING_FUNCTION_TYPES windowType, int scalingFLAG, float *filterbank)
 Computes a bank of FIR filter coefficients required to divide a signal into frequency bands.
 

Detailed Description

A collection of IIR/FIR filter and filterbank designs.

Author
Leo McCormack
Date
01.03.2019
License
ISC

Definition in file saf_utility_filters.h.