DC Offset Elimination (DCOE) State.
This is the required state information for a single channel to which the DC offset elimination filter is to be applied.
To apply the DC offset elimination filter to multiple channels simultaneously, an array of
dcoe_chan_state_tshould be used.
dcoe_state_init()is used once to initialize an array of state objects, and
dcoe_filter()is used on each consecutive sample to apply the filter and get the resulting output sample.
DC offset elimination is an IIR filter. The state must persist between time steps.
- Use in lib_mic_array
Typical users of lib_mic_array will not need to directly use this type or any functions which take it as a parameter.
The C++ class template
mic_array::DcoeSampleFilter, if used in an application’s mic array unit, will allocate, initialize and apply the DCOE filter automatically.
- With MicArray Prefabs
- With Vanilla API
When using the ‘vanilla’ API, DCOE is enabled by default. To disable DCOE when using this API, add a preprocessor definition to the compiler flags, setting
Previous output sample value.
void dcoe_state_init(dcoe_chan_state_t state, const unsigned chan_count)#
Initialize DCOE states.
The DC offset elimination state needs to be intialized before the filter can be applied. This function initializes it.
For correct behavior, the state vector
statemust persist between audio samples and is supplied with each call to
state – [in] Array of
dcoe_chan_state_tto be initialized.
chan_count – [in] Number of elements in
void dcoe_filter(int32_t new_output, dcoe_chan_state_t state, int32_t new_input, const unsigned chan_count)#
Apply DCOE filter.
Applies the DC offset elimination filter to get a new output sample and updates the filter state.
For correct behavior, this function should be called once per sample (here “sample” refers to a vector-valued quantity containing one element for each audio channel) of that stream.
The index of each array (
new_output) corresponds to the audio channel. The update associated with each audio channel is independent of each other audio channel.
The equation used for each channel is:
y[t] = R * y[t-1] + x[t] - x[t-1]
tis the current sample time index,
yis the output signal,
xis the input signal, and
To filter a sample in-place use the same array for both the
new_output – [out] Array into which the output sample will be placed.
state – [in] DC offset elimination state vector.
new_input – [in] New input sample.
chan_count – [in] Number of channels to be processed.