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
#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
| Parameter | Type | Description |
|---|---|---|
| filter | struct xtos_bandpass_filter * | Non-NULL caller-owned filter state. |
| sample_rate_hz | double | Sampling rate in Hz; must be positive, with no explicit finite check. |
| low_cut_hz | double | Low cutoff in Hz; must be positive, with no explicit finite check. |
| high_cut_hz | double | High 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
| errno | Condition |
|---|---|
| EINVAL | filter 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.