Dsp Filter Apply
dsp_filter_applyApply designed or specified IIR/FIR filters to JSON or CSV sample data, with zero-phase filtering, delay compensation, stability checks, and output statistics in a CSV artifact.
Instructions
Apply a filter to samples. Give the filter as sos (JSON rows [b0,b1,b2,a0,a1,a2]), or b (and a; empty a = FIR), or a design (family, response, order+cutoff or passband_edge/stopband_edge, as in dsp_filter_design). IIR runs as transposed direct form II; an unstable IIR filter is refused unless allow_unstable. zero_phase=true filters forward and backward (odd-reflection edge extension, steady-state start; the result has no phase delay and the squared magnitude response). FIR delay (N-1)/2 samples is reported, and removed with compensate_delay. Samples: JSON list or CSV file. Returns input/output statistics, the stability check, the delay, and the output as a CSV artifact.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "dsp_filter_apply"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | No | Denominator coefficients as JSON list, a[0] not 0; empty = FIR | |
| b | No | Numerator coefficients as JSON list (at most 4095 for FIR, 41 with a) | |
| sos | No | Second-order sections as JSON, e.g. '[[0.2,0.4,0.2,1,-0.3,0.1]]' (rows b0,b1,b2,a0,a1,a2; at most 40 rows) | |
| order | No | Design: IIR prototype order 1..40, or FIR taps 3..4095; 0 = from the specification | |
| column | No | Value column of samples_file, by header name or number (1 = first); blank = the single value column | |
| cutoff | No | Design with order: cutoff frequency with unit ('low, high' for bands) | |
| family | No | Design instead of sos/b: butterworth, chebyshev1, chebyshev2, fir_rectangular, fir_hann, fir_hamming, fir_blackman, fir_kaiser | |
| samples | No | Samples as JSON text, e.g. '[0, 1, 0, -1]' (at most 4194304). Or use samples_file | |
| response | No | Design: lowpass, highpass, bandpass or bandstop | |
| zero_phase | No | Forward-backward filtering (default false) | |
| kaiser_beta | No | Design fir_kaiser: beta; 0 = from the attenuation | |
| sample_rate | No | Sample rate with unit, e.g. '8 kHz'; needed for a design, otherwise only for time stamps | |
| samples_file | No | Path of a CSV/TXT file: one column of values, or time(s),value; numbers only, optional header line | |
| passband_edge | No | Design specification: passband edge(s) with unit | |
| stopband_edge | No | Design specification: stopband edge(s) with unit | |
| allow_unstable | No | Run an unstable or marginal IIR filter anyway (default false: refused); the output is refused if it overflows | |
| compensate_delay | No | FIR, causal: advance the output by (N-1)/2 samples when that is a whole number (default false) | |
| passband_ripple_db | No | Design: passband ripple Rp in dB | |
| stopband_attenuation_db | No | Design: stopband attenuation Rs in dB |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| data | No | Non-quantity payload (reports, listings) | |
| error | No | ||
| value | No | Primary quantity result | |
| values | No | All named quantity results (includes the primary) | |
| warnings | No | ||
| artifacts | No | ||
| provenance | Yes | What produced the result and from which inputs. | |
| review_status | No | unreviewed |