Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
gslfilter.hh File Reference
#include <bse/bsemath.hh>
Include dependency graph for gslfilter.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  GslIIRFilter
 
struct  GslBiquadConfig
 
struct  GslBiquadFilter
 

Enumerations

enum  GslBiquadNormalize { GSL_BIQUAD_NORMALIZE_PASSBAND, GSL_BIQUAD_NORMALIZE_RESONANCE_GAIN, GSL_BIQUAD_NORMALIZE_PEAK_GAIN }
 
enum  GslBiquadType {
  GSL_BIQUAD_RESONANT_LOWPASS, GSL_BIQUAD_RESONANT_HIGHPASS, GSL_BIQUAD_LOWSHELVE, GSL_BIQUAD_HIGHSHELVE,
  GSL_BIQUAD_PEAK
}
 

Functions

void gsl_filter_butter_rp (uint iorder, double freq, double epsilon, BseComplex *roots, BseComplex *poles)
 
void gsl_filter_tscheb1_rp (uint iorder, double freq, double epsilon, BseComplex *roots, BseComplex *poles)
 
void gsl_filter_tscheb2_rp (uint iorder, double c_freq, double steepness, double epsilon, BseComplex *roots, BseComplex *poles)
 
double gsl_filter_tscheb2_steepness_db (uint iorder, double c_freq, double epsilon, double stopband_db)
 
double gsl_filter_tscheb2_steepness (uint iorder, double c_freq, double epsilon, double residue)
 
void gsl_filter_butter_lp (uint iorder, double freq, double epsilon, double *a, double *b)
 
void gsl_filter_tscheb1_lp (uint iorder, double freq, double epsilon, double *a, double *b)
 
void gsl_filter_tscheb2_lp (uint iorder, double c_freq, double steepness, double epsilon, double *a, double *b)
 
void gsl_filter_butter_hp (uint iorder, double freq, double epsilon, double *a, double *b)
 
void gsl_filter_tscheb1_hp (uint iorder, double freq, double epsilon, double *a, double *b)
 
void gsl_filter_tscheb2_hp (uint iorder, double c_freq, double steepness, double epsilon, double *a, double *b)
 
void gsl_filter_butter_bp (uint iorder, double freq1, double freq2, double epsilon, double *a, double *b)
 
void gsl_filter_tscheb1_bp (uint iorder, double freq1, double freq2, double epsilon, double *a, double *b)
 
void gsl_filter_tscheb2_bp (uint iorder, double freq1, double freq2, double steepness, double epsilon, double *a, double *b)
 
void gsl_filter_butter_bs (uint iorder, double freq1, double freq2, double epsilon, double *a, double *b)
 
void gsl_filter_tscheb1_bs (uint iorder, double freq1, double freq2, double epsilon, double *a, double *b)
 
void gsl_filter_tscheb2_bs (uint iorder, double freq1, double freq2, double steepness, double epsilon, double *a, double *b)
 
void gsl_filter_fir_approx (uint iorder, double *a, uint n_points, const double *freq, const double *value, gboolean interpolate_db)
 
void gsl_iir_filter_setup (GslIIRFilter *f, guint order, const gdouble *a, const gdouble *b, gdouble *buffer)
 
void gsl_iir_filter_change (GslIIRFilter *f, guint order, const gdouble *a, const gdouble *b, gdouble *buffer)
 
void gsl_iir_filter_eval (GslIIRFilter *f, guint n_values, const gfloat *x, gfloat *y)
 
void gsl_biquad_config_init (GslBiquadConfig *c, GslBiquadType type, GslBiquadNormalize normalize)
 
void gsl_biquad_config_setup (GslBiquadConfig *c, gfloat f_fn, gfloat gain, gfloat quality)
 
void gsl_biquad_config_approx_freq (GslBiquadConfig *c, gfloat f_fn)
 
void gsl_biquad_config_approx_gain (GslBiquadConfig *c, gfloat gain)
 
void gsl_biquad_filter_config (GslBiquadFilter *f, GslBiquadConfig *c, gboolean reset_state)
 
void gsl_biquad_filter_eval (GslBiquadFilter *f, guint n_values, const gfloat *x, gfloat *y)
 
gdouble gsl_filter_sine_scan (guint order, const gdouble *a, const gdouble *b, gdouble freq, gdouble mix_freq)
 

Function Documentation

void gsl_filter_butter_bp ( uint  iorder,
double  freq1,
double  freq2,
double  epsilon,
double a,
double b 
)
Parameters
iorderfilter order (must be even)
freq1stopband end frequency (0..pi)
freq2passband end frequency (0..pi)
epsilonfall off at passband frequency (0..1)
aroot polynomial coefficients a[0..iorder]
bpole polynomial coefficients b[0..iorder]

Butterworth bandpass filter.

Here is the call graph for this function:

void gsl_filter_butter_bs ( uint  iorder,
double  freq1,
double  freq2,
double  epsilon,
double a,
double b 
)
Parameters
iorderfilter order (must be even)
freq1passband end frequency (0..pi)
freq2stopband end frequency (0..pi)
epsilonfall off at passband frequency (0..1)
aroot polynomial coefficients a[0..iorder]
bpole polynomial coefficients b[0..iorder]

Butterworth bandstop filter.

Here is the call graph for this function:

void gsl_filter_butter_hp ( uint  iorder,
double  freq,
double  epsilon,
double a,
double b 
)
Parameters
iorderfilter order
freqpassband frequency (0..pi)
epsilonfall off at passband frequency (0..1)
aroot polynomial coefficients a[0..iorder]
bpole polynomial coefficients b[0..iorder]

Butterworth highpass filter.

Here is the call graph for this function:

void gsl_filter_butter_lp ( uint  iorder,
double  freq,
double  epsilon,
double a,
double b 
)
Parameters
iorderfilter order
freqcutoff frequency (0..pi)
epsilonfall off at cutoff frequency (0..1)
aroot polynomial coefficients a[0..iorder]
bpole polynomial coefficients b[0..iorder]

Butterworth lowpass filter.

Referenced by gsl_filter_butter_hp().

Here is the caller graph for this function:

void gsl_filter_fir_approx ( uint  iorder,
double a,
uint  n_points,
const double freq,
const double value,
gboolean  interpolate_db 
)
Parameters
iorderorder of the filter (must be oven, >= 2)
freqthe frequencies of the transfer function
valuethe desired value of the transfer function
interpolate_dbwhether to interpolate the transfer function "value linear" or "dB linear"

Approximates a given transfer function with an iorder-coefficient FIR filter. It is recommended to provide enough frequency values, so that n_points >= iorder.

Here is the call graph for this function:

gdouble gsl_filter_sine_scan ( guint  order,
const gdouble *  a,
const gdouble *  b,
gdouble  freq,
gdouble  mix_freq 
)
Parameters
orderorder of the iir filter
aroot polynomial coefficients of the filter a[0..order]
bpole polynomial coefficients of the filter b[0..order]
freqfrequency to test
mix_freqthe mixing frequency

This function sends a sine signal of the desired frequency through an IIR filter, to test the value of the transfer function at a given point. It uses gsl_iir_filter_eval to do so.

Compared to a "mathematical approach" of finding the transfer function, this function makes it possible to see the effects of finite arithmetic during filter evaluation.

The output volume is averaged over 0.1 seconds, and the filter is evaluated 5 seconds, or until the volume of two adjacent blocks doesn't change anymore, whatever occurs sooner.

Here is the call graph for this function:

void gsl_filter_tscheb1_bp ( uint  iorder,
double  freq1,
double  freq2,
double  epsilon,
double a,
double b 
)
Parameters
iorderfilter order (must be even)
freq1stopband end frequency (0..pi)
freq2passband end frequency (0..pi)
epsilonfall off at passband frequency (0..1)
aroot polynomial coefficients a[0..iorder]
bpole polynomial coefficients b[0..iorder]

Tschebyscheff type 1 bandpass filter.

Here is the call graph for this function:

void gsl_filter_tscheb1_bs ( uint  iorder,
double  freq1,
double  freq2,
double  epsilon,
double a,
double b 
)
Parameters
iorderfilter order (must be even)
freq1passband end frequency (0..pi)
freq2stopband end frequency (0..pi)
epsilonfall off at passband frequency (0..1)
aroot polynomial coefficients a[0..iorder]
bpole polynomial coefficients b[0..iorder]

Tschebyscheff type 1 bandstop filter.

Here is the call graph for this function:

void gsl_filter_tscheb1_hp ( uint  iorder,
double  freq,
double  epsilon,
double a,
double b 
)
Parameters
iorderfilter order
freqpassband frequency (0..pi)
epsilonfall off at passband frequency (0..1)
aroot polynomial coefficients a[0..iorder]
bpole polynomial coefficients b[0..iorder]

Tschebyscheff type 1 highpass filter.

Here is the call graph for this function:

void gsl_filter_tscheb1_lp ( uint  iorder,
double  freq,
double  epsilon,
double a,
double b 
)
Parameters
iorderfilter order
freqcutoff frequency (0..pi)
epsilonfall off at cutoff frequency (0..1)
aroot polynomial coefficients a[0..iorder]
bpole polynomial coefficients b[0..iorder]

Tschebyscheff type 1 lowpass filter.

Referenced by gsl_filter_tscheb1_hp().

Here is the call graph for this function:

Here is the caller graph for this function:

void gsl_filter_tscheb2_bp ( uint  iorder,
double  freq1,
double  freq2,
double  steepness,
double  epsilon,
double a,
double b 
)
Parameters
iorderfilter order (must be even)
freq1stopband end frequency (0..pi)
freq2passband end frequency (0..pi)
steepnessfrequency steepness factor
epsilonfall off at passband frequency (0..1)
aroot polynomial coefficients a[0..iorder]
bpole polynomial coefficients b[0..iorder]

Tschebyscheff type 2 bandpass filter.

Here is the call graph for this function:

void gsl_filter_tscheb2_bs ( uint  iorder,
double  freq1,
double  freq2,
double  steepness,
double  epsilon,
double a,
double b 
)
Parameters
iorderfilter order (must be even)
freq1passband end frequency (0..pi)
freq2stopband end frequency (0..pi)
steepnessfrequency steepness factor
epsilonfall off at passband frequency (0..1)
aroot polynomial coefficients a[0..iorder]
bpole polynomial coefficients b[0..iorder]

Tschebyscheff type 2 bandstop filter.

Here is the call graph for this function:

void gsl_filter_tscheb2_hp ( uint  iorder,
double  freq,
double  steepness,
double  epsilon,
double a,
double b 
)
Parameters
iorderfilter order
freqstopband frequency (0..pi)
steepnessfrequency steepness
epsilonfall off at passband frequency (0..1)
aroot polynomial coefficients a[0..iorder]
bpole polynomial coefficients b[0..iorder]

Tschebyscheff type 2 highpass filter.

Here is the call graph for this function:

void gsl_filter_tscheb2_lp ( uint  iorder,
double  freq,
double  steepness,
double  epsilon,
double a,
double b 
)
Parameters
iorderfilter order
freqpassband cutoff frequency (0..pi)
steepnessfrequency steepness (c_freq * steepness < pi)
epsilonfall off at passband frequency (0..1)
aroot polynomial coefficients a[0..iorder]
bpole polynomial coefficients b[0..iorder]

Tschebyscheff type 2 lowpass filter. To gain a transition band between freq1 and freq2, pass arguements freq=freq1 and steepness=freq2/freq1. To specify the transition band width in fractions of octaves, pass steepness=2^octave_fraction.

Referenced by gsl_filter_tscheb2_hp().

Here is the caller graph for this function:

double gsl_filter_tscheb2_steepness ( uint  iorder,
double  c_freq,
double  epsilon,
double  residue 
)
Parameters
iorderfilter order
c_freqpassband cutoff frequency (0..pi)
epsilonfall off at passband frequency (0..1)
residuemaximum of transfer function in stopband (0..1)

Calculates the steepness parameter for Tschebyscheff type 2 lowpass filter, based on ripple residue in the stop band.

Referenced by gsl_filter_tscheb2_steepness_db().

Here is the call graph for this function:

Here is the caller graph for this function:

double gsl_filter_tscheb2_steepness_db ( uint  iorder,
double  c_freq,
double  epsilon,
double  stopband_db 
)
Parameters
iorderfilter order
c_freqpassband cutoff frequency (0..pi)
epsilonfall off at passband frequency (0..1)
stopband_dbreduction in stopband in dB (>= 0)

Calculates the steepness parameter for Tschebyscheff type 2 lowpass filter, based on the ripple residue in the stop band.

Here is the call graph for this function: