13#ifndef SBL_DSP_PRIMITIVES_FOLDER_HPP_
14#define SBL_DSP_PRIMITIVES_FOLDER_HPP_
27 void process(
float* buf, uint16_t frames) {
28 for (uint16_t i = 0; i < frames; ++i) {
29 buf[i] =
fold(buf[i]);
34 static float fold(
float x) {
35 const float p = x + 1.0f;
36 const float q = p - 4.0f * floorf(p * 0.25f);
37 return (q < 2.0f) ? (q - 1.0f) : (3.0f - q);
void process(float *buf, uint16_t frames)
Process a block in-place.
static float fold(float x)
The fold function, available for math use (e.g., WavefoldAA antiderivatives)
float process(float x)
Process a single sample — fold x into [-1, 1] via triangle-wave reflection.
Stateful, single-concern building blocks.