Skip to content

Conversation

@possibly-human
Copy link
Contributor

@possibly-human possibly-human commented Dec 9, 2025

Summary

Adds an exponential moving average (EMA) filter for real-time signal smoothing. The module provides multiple equivalent control options of the smoothing behavior: direct alpha coefficient, time constant in seconds (τ), and equivalent low-pass cutoff frequency in Hz. Includes a cumulative averaging mode for infinite-window statistics. All parameters are mathematically linked—changing one automatically updates the others to maintain consistency.

Functionality

Inputs are:

  • Signal (int or float) — Raw input signal to smooth

Parameters are:

  • Cumulative average (bool) — Enable infinite-window averaging (α = 1/(n+1))
  • Alpha coefficient (float) — Direct smoothing coefficient (0.0-1.0 range)
  • Time window tau (s) (float) — EMA time constant in seconds (0.0-1000.0 range)
  • Cutoff frequency (Hz) (float) — Equivalent low-pass filter frequency (0.01-2000.0 Hz range)

Outputs are:

  • Smoothed (float) — Filtered output signal

@jcelerier jcelerier self-requested a review December 9, 2025 02:42
@possibly-human
Copy link
Contributor Author

possibly-human commented Dec 12, 2025

Testing

Was tested on Linux (booted on a T2 chip, 2019 MacBook Pro)

Once with LFO generated values :
smoother_lfo

Example file : https://drive.google.com/file/d/1Vy6u1A8CrDKf1CmDdzygoxUBVTr6xpr0/view?usp=sharing

And once with live data from Sensors2OSC (device orientation).
smoother with live data
smoother_livedata
(here, many copies of Smoother were used to test control from the different parameters, while waiting for the implementation of the live linking of the parameters)

TODO (test against Python when live linking is implemented)

@possibly-human possibly-human merged commit b19e8c0 into master Dec 12, 2025
7 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants