Skip to main content

Module select

Module select 

Source
Expand description

Channel projection and windowed-sinc FIR decimation for select/1 (docs/roadmap.md, step 6).

§Decimation filter specification

For an integer decimation factor D >= 2, the outlet applies a symmetric Type I linear-phase Hamming-windowed sinc low-pass FIR filter to each selected numeric channel before keeping one sample every D input samples:

  • Tap count: N = (4 * D + 1).min(257) (always odd, center M = (N - 1) / 2).
  • Normalized cutoff frequency: fc = 0.45 / D (cycles per input sample).
  • Unnormalized impulse response for k = 0..N:
    • h_raw[M] = 2 * fc
    • h_raw[k] = sin(2 * pi * fc * (k - M)) / (pi * (k - M)) for k != M
  • Hamming window: w[k] = 0.54 - 0.46 * cos(2 * pi * k / (N - 1)).
  • Normalized taps: h[k] = (h_raw[k] * w[k]) / sum_j(h_raw[j] * w[j]).

The DC gain is exactly 1.0. Each decimated output sample carries the timestamp of the center tap (t_last - M / nominal_srate), removing the constant group delay of the linear-phase filter.

Structs§

StreamSelector
Per-consumer channel selector and streaming FIR decimator.

Functions§

fir_taps
Compute the normalized Hamming-windowed sinc low-pass FIR taps for integer decimation factor decimate.
project_packed
Project one PackedSample to the ordered channel indices in channels, keeping the exact bits of every selected channel across all seven formats.