18#ifndef SBL_COMPONENTS_CV_INPUT_HPP_
19#define SBL_COMPONENTS_CV_INPUT_HPP_
54 : filter_(static_cast<uint8_t>(config.smoothing)), raw_(0) {}
57 : filter_(static_cast<uint8_t>(smoothing)), raw_(0) {}
66 uint16_t
raw()
const {
return raw_; }
82 int32_t
scaled(int32_t min, int32_t max)
const {
83 int64_t v = filter_.
value();
84 return static_cast<int32_t
>(min + (v * (max - min)) / 65535);
102 return static_cast<int32_t
>(min + (v * (max - min)) / 65535);
uint16_t update(uint16_t raw)
Feed a new sample and return the smoothed value.
uint16_t value() const
Return current smoothed value without updating.
void reset()
Reset filter state (next update will re-seed)
Exponentially Weighted Moving Average filter.
Smoothing
Smoothing presets for CvInput EWMA filter.
@ None
Raw passthrough (no filtering)
@ Medium
alpha=1/8, settles in ~24 samples (pots, knobs)
@ Light
alpha=1/2, settles in ~4 samples (pitch, fast CV)
@ Heavy
alpha=1/32, settles in ~96 samples (noisy sources)
static constexpr uint16_t Log
Root namespace for all Sound Byte Libs functionality.
static uint16_t warp(uint16_t phase, uint16_t curve)