Sound Byte Libs 0.5.1-121-g3358a44
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: sbl::primitives::math::Ewma filter(3); uint16_t smoothed = filter.update(raw_adc_value);

Definition in file ewma.hpp.

#include <cstdint>

Go to the source code of this file.

Classes

class  sbl::primitives::math::Ewma
 

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs code.
 
namespace  sbl::primitives
 Hardware-side primitives: buffers and integer math.
 
namespace  sbl::primitives::math
 Integer and fixed-point helpers.