Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
ewma.hpp File Reference

Exponentially Weighted Moving Average filter. More...

Detailed Description

Exponentially Weighted Moving Average filter.

Integer-only EWMA with Q16 internal state for sub-LSB precision. Uses power-of-2 shift for the smoothing factor (no division). Suitable for Cortex-M0+ (no FPU required).

Alpha = 1 / 2^shift:

shift=1 -> alpha=1/2 (fast tracking, little smoothing)
shift=3 -> alpha=1/8 (good default for pots)
shift=5 -> alpha=1/32 (heavy smoothing)

Usage:

uint16_t smoothed = filter.update(raw_adc_value);
Integer EWMA filter, alpha = 1 / 2^shift.
Definition ewma.hpp:38

Definition in file ewma.hpp.

#include <cstdint>

Go to the source code of this file.

Classes

class  sbl::control::input::Ewma
 Integer EWMA filter, alpha = 1 / 2^shift. More...
 

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs code.
 
namespace  sbl::control
 The control stack: scheduler, event queue, merge, CC mapping, calibration.
 
namespace  sbl::control::input
 Inputs: debounce, decoding, smoothing and scaling of raw samples.