signal/filter
src/signal/filter.tur
defn
low-pass
(low-pass [alpha :float])
first-order IIR low-pass filter Signal Function.
Parameters
| alpha | smoothing coefficient in (0, 1); lower = more smoothing. |
Returns
SF Sample Sample. Each instance owns its own state cell, so the same `(low-pass alpha)` SF is stateful from the moment it is applied to an input signal.
Example
((low-pass 0.3) (sine 440.0 0.0))
defn
high-pass
(high-pass [alpha :float])
first-order IIR high-pass filter Signal Function.
Parameters
| alpha | smoothing coefficient of the internal low-pass tap | |
| (matches `low-pass`'s convention). |
Returns
SF Sample Sample emitting `x - low_pass(x)` per sample.
Example
((high-pass 0.3) (sawtooth 110.0))
Internal definitions
__filter_alloc_state-- allocate a zero-initialized double cell.__filter_lp_step-- low-pass EMA step.__filter_hp_step-- high-pass step.