Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::QuantizerT< SampleType > Class Template Reference

Snap a control value to N equally spaced levels across a range. More...

#include <mod_tools.hpp>

Public Member Functions

void set_range (SampleType lo, SampleType hi)
void set_steps (int n)
SampleType process (SampleType x) const
int steps () const

Detailed Description

template<typename SampleType = float>
class pulp::signal::QuantizerT< SampleType >

Snap a control value to N equally spaced levels across a range.

N levels means N - 1 intervals: set_steps(2) over [0, 1] outputs only 0 and 1. Inputs outside the range clamp to the end levels. Ties round away from zero, matching std::lround.

Pitch quantization to a musical scale is deliberately not here — that needs a scale, a root, and a note-vs-frequency decision, and it belongs with the MIDI side rather than in a control-signal utility.

RT contract: stateless; audio-thread safe.

USE: stepped filter sweeps and stepped pitch modulation; making a smooth random source into an arpeggio-like sequence; using coarse quantization as a deliberate lo-fi effect on a modulation path rather than on the audio.

Member Function Documentation

◆ process()

template<typename SampleType = float>
SampleType pulp::signal::QuantizerT< SampleType >::process ( SampleType x) const
inline

◆ set_range()

template<typename SampleType = float>
void pulp::signal::QuantizerT< SampleType >::set_range ( SampleType lo,
SampleType hi )
inline

◆ set_steps()

template<typename SampleType = float>
void pulp::signal::QuantizerT< SampleType >::set_steps ( int n)
inline

◆ steps()

template<typename SampleType = float>
int pulp::signal::QuantizerT< SampleType >::steps ( ) const
inline

The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/signal/include/pulp/signal/mod_tools.hpp