XTOS / OPEN SOURCE REAL-TIME SYSTEMOPEN SOURCE · VERSION 0.9.0 · BUILD FROM SOURCE
libxtos-signalxtos_notch_init

xtos_notch_init

Initializes a second-order IIR notch filter’s coefficients and history state.

On this page

Declaration

c
#include <xtos/signal.h>

int xtos_notch_init(struct xtos_notch_filter *filter,
                    double sample_rate_hz,
                    double notch_frequency_hz,
                    double quality_factor);

Parameters

ParameterTypeDescription
filterstruct xtos_notch_filter *Non-NULL caller-owned filter state.
sample_rate_hzdoubleSampling rate in Hz; implementation requires it to be positive but does not explicitly check finite.
notch_frequency_hzdoubleNotch center frequency in Hz, requiring 0 < f0 < fs/2; finite is not explicitly checked.
quality_factordoubleQ value, required to be positive; finite is not explicitly checked.

Return value

Returns 0 on success and -1 on failure. Success clears filter history.

Errors

errnoCondition
EINVALfilter is NULL or the comparisons fs>0, 0<f0<fs/2, and Q>0 fail.

Notes

  • The public implementation has no isfinite check; callers must reject NaN/Inf first and must not treat no error as numeric validation.
  • Reinitialization discards history and creates a transient; keep one independent state per channel for a continuous signal.

Example

Source

This reference describes headers and implementation at OpenXTOS commit dd313955ad57542bcd2af8827157d1bbd0cf5e83.