aubio 0.4.9
Typedefs | Functions
filter.h File Reference

Digital filter. More...

Go to the source code of this file.

Typedefs

typedef struct _aubio_filter_t aubio_filter_t
 Digital filter. More...
 

Functions

void aubio_filter_do (aubio_filter_t *f, fvec_t *in)
 filter input vector (in-place) More...
 
void aubio_filter_do_outplace (aubio_filter_t *f, const fvec_t *in, fvec_t *out)
 filter input vector (out-of-place) More...
 
void aubio_filter_do_filtfilt (aubio_filter_t *f, fvec_t *in, fvec_t *tmp)
 filter input vector forward and backward More...
 
lvec_taubio_filter_get_feedback (const aubio_filter_t *f)
 returns a pointer to feedback coefficients \( a_i \) More...
 
lvec_taubio_filter_get_feedforward (const aubio_filter_t *f)
 returns a pointer to feedforward coefficients \( b_i \) More...
 
uint_t aubio_filter_get_order (const aubio_filter_t *f)
 get order of the filter More...
 
uint_t aubio_filter_get_samplerate (const aubio_filter_t *f)
 get sampling rate of the filter More...
 
uint_t aubio_filter_set_samplerate (aubio_filter_t *f, uint_t samplerate)
 get sampling rate of the filter More...
 
void aubio_filter_do_reset (aubio_filter_t *f)
 reset filter memory More...
 
aubio_filter_tnew_aubio_filter (uint_t order)
 create new filter object More...
 
void del_aubio_filter (aubio_filter_t *f)
 delete a filter object More...
 

Detailed Description

Digital filter.

This object stores a digital filter of order \(n\). It contains the following data:

For convenience, the samplerate of the input signal is also stored in the object.

Feedforward and feedback parameters can be modified using aubio_filter_get_feedback() and aubio_filter_get_feedforward().

The function aubio_filter_do_outplace() computes the following output signal \( y[n] \) from the input signal \( x[n] \):

\begin{eqnarray*} y[n] = b_0 x[n] & + & b_1 x[n-1] + b_2 x[n-2] + ... + b_P x[n-P] \\ & - & a_1 y[n-1] - a_2 y[n-2] - ... - a_P y[n-P] \\ \end{eqnarray*}

The function aubio_filter_do() executes the same computation but modifies directly the input signal (in-place).

The function aubio_filter_do_filtfilt() version runs the filter twice, first forward then backward, to compensate with the phase shifting of the forward operation.

Some convenience functions are provided:

Definition in file filter.h.

Typedef Documentation

◆ aubio_filter_t

typedef struct _aubio_filter_t aubio_filter_t

Digital filter.

Definition at line 72 of file filter.h.

Function Documentation

◆ aubio_filter_do()

void aubio_filter_do ( aubio_filter_t f,
fvec_t in 
)

filter input vector (in-place)

Parameters
ffilter object as returned by new_aubio_filter()
ininput vector to filter
Examples
temporal/test-biquad.c, and temporal/test-filter.c.

◆ aubio_filter_do_filtfilt()

void aubio_filter_do_filtfilt ( aubio_filter_t f,
fvec_t in,
fvec_t tmp 
)

filter input vector forward and backward

Parameters
faubio_filter_t object as returned by new_aubio_filter()
infvec_t input vector to filter
tmpmemory space to use for computation
Examples
temporal/test-biquad.c, and temporal/test-filter.c.

◆ aubio_filter_do_outplace()

void aubio_filter_do_outplace ( aubio_filter_t f,
const fvec_t in,
fvec_t out 
)

filter input vector (out-of-place)

Parameters
ffilter object as returned by new_aubio_filter()
ininput vector to filter
outoutput vector to store filtered input
Examples
temporal/test-biquad.c, and temporal/test-filter.c.

◆ aubio_filter_do_reset()

void aubio_filter_do_reset ( aubio_filter_t f)

reset filter memory

Parameters
ffilter object as returned by new_aubio_filter()

◆ aubio_filter_get_feedback()

lvec_t * aubio_filter_get_feedback ( const aubio_filter_t f)

returns a pointer to feedback coefficients \( a_i \)

Parameters
ffilter object to get parameters from
Returns
a pointer to the \( a_0 ... a_i ... a_P \) coefficients

◆ aubio_filter_get_feedforward()

lvec_t * aubio_filter_get_feedforward ( const aubio_filter_t f)

returns a pointer to feedforward coefficients \( b_i \)

Parameters
ffilter object to get coefficients from
Returns
a pointer to the \( b_0 ... b_i ... b_P \) coefficients

◆ aubio_filter_get_order()

uint_t aubio_filter_get_order ( const aubio_filter_t f)

get order of the filter

Parameters
ffilter to get order from
Returns
the order of the filter

◆ aubio_filter_get_samplerate()

uint_t aubio_filter_get_samplerate ( const aubio_filter_t f)

get sampling rate of the filter

Parameters
ffilter to get sampling rate from
Returns
the sampling rate of the filter, in Hz
Examples
temporal/test-filter.c.

◆ aubio_filter_set_samplerate()

uint_t aubio_filter_set_samplerate ( aubio_filter_t f,
uint_t  samplerate 
)

get sampling rate of the filter

Parameters
ffilter to get sampling rate from
sampleratesample rate to set the filter to
Returns
the sampling rate of the filter, in Hz

◆ del_aubio_filter()

void del_aubio_filter ( aubio_filter_t f)

delete a filter object

Parameters
ffilter object to delete
Examples
temporal/test-a_weighting.c, temporal/test-biquad.c, temporal/test-c_weighting.c, and temporal/test-filter.c.

◆ new_aubio_filter()

aubio_filter_t * new_aubio_filter ( uint_t  order)

create new filter object

This function creates a new aubio_filter_t object, given the order of the filter.

Parameters
orderorder of the filter (number of coefficients)
Returns
the newly created filter object
Examples
temporal/test-a_weighting.c, temporal/test-c_weighting.c, and temporal/test-filter.c.