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

xtos_bandpass_init

Initializes a fourth-order band-pass baseline made from a second-order high-pass followed by low-pass.

On this page

Declaration

c
#include <xtos/signal.h>

int xtos_bandpass_init(struct xtos_bandpass_filter *filter,
                       double sample_rate_hz,
                       double low_cut_hz,
                       double high_cut_hz);

Parameters

ParameterTypeDescription
filterstruct xtos_bandpass_filter *Non-NULL caller-owned filter state.
sample_rate_hzdoubleSampling rate in Hz; must be positive, with no explicit finite check.
low_cut_hzdoubleLow cutoff in Hz; must be positive, with no explicit finite check.
high_cut_hzdoubleHigh cutoff in Hz; must exceed low_cut and be below fs/2, with no explicit finite check.

Return value

Returns 0 on success and -1 on failure. Success clears history in both stages.

Errors

errnoCondition
EINVALfilter is NULL, or fs, low, and high fail the positive-value and low<high<fs/2 constraints.

Notes

  • Both biquads use a fixed Q of about 0.7071; the public implementation has no isfinite check.
  • Initialization and reinitialization clear state and create a transient; recompute coefficients after rate or cutoff changes.

Example

Source

This reference describes headers and implementation at OpenXTOS commit dd313955ad57542bcd2af8827157d1bbd0cf5e83.