![]()  | 
  
    VCV Rack API v2
    
   | 
 
Digital signal processing routines and classes. More...
Classes | |
| struct | Frame | 
| Useful for storing arrays of samples in ring buffers and casting them to float* to be used by interleaved processors, like SampleRateConverter.  More... | |
| struct | BooleanTrigger | 
| Detects when a boolean changes from false to true.  More... | |
| struct | TSchmittTrigger | 
| Turns HIGH when value reaches a threshold (default 0.f), turns LOW when value reaches a threshold (default 1.f).  More... | |
| struct | TSchmittTrigger< float > | 
| struct | PulseGenerator | 
| When triggered, holds a high value for a specified time before going low again.  More... | |
| struct | TTimer | 
| Accumulates a timer when process() is called.  More... | |
| struct | ClockDivider | 
| Counts calls to process(), returning true every division calls.  More... | |
| struct | RealFFT | 
| Real-valued FFT context.  More... | |
| struct | ComplexFFT | 
| Complex-valued FFT context.  More... | |
| struct | TRCFilter | 
| The simplest possible analog filter using an Euler solver.  More... | |
| struct | TExponentialFilter | 
| Applies exponential smoothing to a signal with the ODE \( \frac{dy}{dt} = x \lambda \).  More... | |
| struct | TPeakFilter | 
| Like ExponentialFilter but jumps immediately to higher values.  More... | |
| struct | TSlewLimiter | 
| Limits the derivative of the output by a rise and fall speed, in units/s.  More... | |
| struct | TExponentialSlewLimiter | 
| Behaves like ExponentialFilter but with different lambas when the RHS of the ODE is positive or negative.  More... | |
| struct | IIRFilter | 
| Digital IIR filter processor.  More... | |
| struct | TBiquadFilter | 
| struct | RealTimeConvolver | 
| struct | MidiGenerator | 
| Converts gates and CV to MIDI messages.  More... | |
| struct | MidiParser | 
| Converts MIDI note and transport messages to gates, CV, and other states.  More... | |
| struct | MinBlepGenerator | 
| struct | SampleRateConverter | 
| Resamples by a fixed rational factor.  More... | |
| struct | Decimator | 
| Downsamples by an integer factor.  More... | |
| struct | Upsampler | 
| Upsamples by an integer factor.  More... | |
| struct | RingBuffer | 
| Lock-free queue with fixed size and no allocations.  More... | |
| struct | DoubleRingBuffer | 
| A cyclic buffer which maintains a valid linear array of size S by keeping a copy of the buffer in adjacent memory.  More... | |
| struct | AppleRingBuffer | 
| A cyclic buffer which maintains a valid linear array of size S by sliding along a larger block of size N.  More... | |
| struct | VuMeter | 
| Deprecated.  More... | |
| struct | VuMeter2 | 
| Models a VU meter with smoothing.  More... | |
Typedefs | |
| typedef TSchmittTrigger | SchmittTrigger | 
| typedef TTimer | Timer | 
| typedef TRCFilter | RCFilter | 
| typedef TExponentialFilter | ExponentialFilter | 
| typedef TPeakFilter | PeakFilter | 
| typedef TSlewLimiter | SlewLimiter | 
| typedef TExponentialSlewLimiter | ExponentialSlewLimiter | 
| typedef TBiquadFilter | BiquadFilter | 
Functions | |
| template<typename T, size_t N> | |
| T | polyDirect (const T(&a)[N], T x) | 
| Evaluates a polynomial with coefficients a[n] at x.   | |
| template<typename T, size_t N> | |
| T | polyHorner (const T(&a)[N], T x) | 
| Evaluates a polynomial with coefficients a[n] at x.   | |
| template<typename T, size_t N> | |
| T | polyEstrin (const T(&a)[N], T x) | 
| Evaluates a polynomial with coefficients a[n] at x.   | |
| template<typename T> | |
| T | exp2Floor (T x, T *xf) | 
| Returns 2^floor(x).   | |
| template<> | |
| float | exp2Floor (float x, float *xf) | 
| template<> | |
| simd::float_4 | exp2Floor (simd::float_4 x, simd::float_4 *xf) | 
| template<typename T> | |
| T | approxExp2Floor (T x, T *xf) | 
| Deprecated alias of exp2Floor().   | |
| template<typename T> | |
| T | exp2_taylor5 (T x) | 
| Returns 2^x with at most 6e-06 relative error.   | |
| template<typename T> | |
| T | approxExp2_taylor5 (T x) | 
| Deprecated alias of exp2_taylor5().   | |
| float | sinc (float x) | 
| The normalized sinc function See https://en.wikipedia.org/wiki/Sinc_function.   | |
| template<typename T> | |
| T | sinc (T x) | 
| template<typename T> | |
| T | amplitudeToDb (T amp) | 
| template<typename T> | |
| T | dbToAmplitude (T db) | 
| template<typename T> | |
| T | quadraticBipolar (T x) | 
| template<typename T> | |
| T | cubic (T x) | 
| template<typename T> | |
| T | quarticBipolar (T x) | 
| template<typename T> | |
| T | quintic (T x) | 
| template<typename T> | |
| T | sqrtBipolar (T x) | 
| template<typename T> | |
| T | exponentialBipolar (T b, T x) | 
| This is pretty much a scaled sinh.   | |
| struct | __attribute__ ((packed, aligned(1), gcc_struct)) Int24 | 
| 24-bit integer, using int32_t for conversions.   | |
| template<typename To, typename From> | |
| To | convert (From x)=delete | 
| Converts between normalized types.   | |
| template<> | |
| float | convert (float x) | 
| Trivial conversions.   | |
| template<> | |
| float | convert (int8_t x) | 
| Integer to float.   | |
| template<> | |
| float | convert (int16_t x) | 
| template<> | |
| float | convert (Int24 x) | 
| template<> | |
| float | convert (int32_t x) | 
| template<> | |
| float | convert (int64_t x) | 
| template<> | |
| int8_t | convert (float x) | 
| Float to integer.   | |
| template<> | |
| int16_t | convert (float x) | 
| template<> | |
| Int24 | convert (float x) | 
| template<> | |
| int32_t | convert (float x) | 
| template<> | |
| int64_t | convert (float x) | 
| template<typename To, typename From> | |
| void | convert (const From *in, To *out, size_t len) | 
| Buffer conversion.   | |
| float | convolveNaive (const float *in, const float *kernel, int len) | 
| Performs a direct sum convolution.   | |
| void | boxcarLowpassIR (float *out, int len, float cutoff=0.5f) | 
| Computes the impulse response of a boxcar lowpass filter.   | |
| void | minBlepImpulse (int z, int o, float *output) | 
| Computes the minimum-phase bandlimited step (MinBLEP) z: number of zero-crossings o: oversample factor output: must be length 2 * z * o.   | |
| template<typename T, typename F> | |
| void | stepEuler (T t, T dt, T x[], int len, F f) | 
| The callback function f in each of these stepping functions must have the signature.   | |
| template<typename T, typename F> | |
| void | stepRK2 (T t, T dt, T x[], int len, F f) | 
| Solves an ODE system using the 2nd order Runge-Kutta method.   | |
| template<typename T, typename F> | |
| void | stepRK4 (T t, T dt, T x[], int len, F f) | 
| Solves an ODE system using the 4th order Runge-Kutta method.   | |
| template<typename T> | |
| T | hann (T p) | 
| Hann window function.   | |
| void | hannWindow (float *x, int len) | 
| Multiplies the Hann window by a signal x of length len in-place.   | |
| template<typename T> | |
| T | blackman (T alpha, T p) | 
| Blackman window function.   | |
| void | blackmanWindow (float alpha, float *x, int len) | 
| template<typename T> | |
| T | blackmanNuttall (T p) | 
| Blackman-Nuttall window function.   | |
| void | blackmanNuttallWindow (float *x, int len) | 
| template<typename T> | |
| T | blackmanHarris (T p) | 
| Blackman-Harris window function.   | |
| void | blackmanHarrisWindow (float *x, int len) | 
Variables | |
| DEPRECATED typedef VuMeter | VUMeter | 
| static const float | FREQ_C4 = 261.6256f | 
| static const float | FREQ_A4 = 440.0000f | 
| static const float | FREQ_SEMITONE = 1.0594630943592953f | 
Digital signal processing routines and classes.
| typedef TTimer rack::dsp::Timer | 
| typedef TRCFilter rack::dsp::RCFilter | 
| typedef TPeakFilter rack::dsp::PeakFilter | 
| typedef TSlewLimiter rack::dsp::SlewLimiter | 
| typedef TBiquadFilter rack::dsp::BiquadFilter | 
| T rack::dsp::polyDirect | ( | const T(&) | a[N], | 
| T | x ) | 
Evaluates a polynomial with coefficients a[n] at x.
Uses naive direct evaluation.
| T rack::dsp::polyHorner | ( | const T(&) | a[N], | 
| T | x ) | 
Evaluates a polynomial with coefficients a[n] at x.
Uses Horner's method. https://en.wikipedia.org/wiki/Horner%27s_method
| T rack::dsp::polyEstrin | ( | const T(&) | a[N], | 
| T | x ) | 
Evaluates a polynomial with coefficients a[n] at x.
Uses Estrin's method. https://en.wikipedia.org/wiki/Estrin%27s_scheme
| T rack::dsp::exp2Floor | ( | T | x, | 
| T * | xf ) | 
Returns 2^floor(x).
If xf is given, sets it to the fractional part of x. This is useful in the computation 2^x = 2^floor(x) * 2^frac(x).
      
  | 
  inline | 
      
  | 
  inline | 
| T rack::dsp::approxExp2Floor | ( | T | x, | 
| T * | xf ) | 
Deprecated alias of exp2Floor().
| T rack::dsp::exp2_taylor5 | ( | T | x | ) | 
Returns 2^x with at most 6e-06 relative error.
Polynomial coefficients are chosen to minimize relative error while maintaining continuity and giving exact values at integer values of x. Thanks to Andy Simper for coefficients.
| T rack::dsp::approxExp2_taylor5 | ( | T | x | ) | 
Deprecated alias of exp2_taylor5().
      
  | 
  inline | 
The normalized sinc function See https://en.wikipedia.org/wiki/Sinc_function.
| T rack::dsp::sinc | ( | T | x | ) | 
| T rack::dsp::amplitudeToDb | ( | T | amp | ) | 
| T rack::dsp::dbToAmplitude | ( | T | db | ) | 
| T rack::dsp::quadraticBipolar | ( | T | x | ) | 
| T rack::dsp::cubic | ( | T | x | ) | 
| T rack::dsp::quarticBipolar | ( | T | x | ) | 
| T rack::dsp::quintic | ( | T | x | ) | 
| T rack::dsp::sqrtBipolar | ( | T | x | ) | 
| T rack::dsp::exponentialBipolar | ( | T | b, | 
| T | x ) | 
This is pretty much a scaled sinh.
Slow. Not recommended for parameter scaling.
| struct rack::dsp::__attribute__ | ( | (packed, aligned(1), gcc_struct) | ) | 
24-bit integer, using int32_t for conversions.
      
  | 
  delete | 
Converts between normalized types.
      
  | 
  inline | 
Trivial conversions.
      
  | 
  inline | 
Integer to float.
      
  | 
  inline | 
      
  | 
  inline | 
      
  | 
  inline | 
      
  | 
  inline | 
      
  | 
  inline | 
Float to integer.
      
  | 
  inline | 
      
  | 
  inline | 
      
  | 
  inline | 
      
  | 
  inline | 
| void rack::dsp::convert | ( | const From * | in, | 
| To * | out, | ||
| size_t | len ) | 
Buffer conversion.
      
  | 
  inline | 
Performs a direct sum convolution.
      
  | 
  inline | 
Computes the impulse response of a boxcar lowpass filter.
| void rack::dsp::minBlepImpulse | ( | int | z, | 
| int | o, | ||
| float * | output ) | 
Computes the minimum-phase bandlimited step (MinBLEP) z: number of zero-crossings o: oversample factor output: must be length 2 * z * o.
| void rack::dsp::stepEuler | ( | T | t, | 
| T | dt, | ||
| T | x[], | ||
| int | len, | ||
| F | f ) | 
The callback function f in each of these stepping functions must have the signature.
void f(T t, const T x[], T dxdt[])
A capturing lambda is ideal for this. For example, the following solves the system x''(t) = -x(t) using a fixed timestep of 0.01 and initial conditions x(0) = 1, x'(0) = 0.
float x[2] = {1.f, 0.f};
float dt = 0.01f;
for (float t = 0.f; t < 1.f; t += dt) {
    rack::ode::stepRK4(t, dt, x, 2, [&](float t, const float x[], float dxdt[]) {
        dxdt[0] = x[1];
        dxdt[1] = -x[0];
    });
    printf("%f\n", x[0]);
}
Solves an ODE system using the 1st order Euler method
| void rack::dsp::stepRK2 | ( | T | t, | 
| T | dt, | ||
| T | x[], | ||
| int | len, | ||
| F | f ) | 
Solves an ODE system using the 2nd order Runge-Kutta method.
| void rack::dsp::stepRK4 | ( | T | t, | 
| T | dt, | ||
| T | x[], | ||
| int | len, | ||
| F | f ) | 
Solves an ODE system using the 4th order Runge-Kutta method.
      
  | 
  inline | 
Hann window function.
p: proportion from [0, 1], usually i / (len - 1) https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows
      
  | 
  inline | 
Multiplies the Hann window by a signal x of length len in-place.
      
  | 
  inline | 
Blackman window function.
https://en.wikipedia.org/wiki/Window_function#Blackman_window A typical alpha value is 0.16.
      
  | 
  inline | 
      
  | 
  inline | 
Blackman-Nuttall window function.
https://en.wikipedia.org/wiki/Window_function#Blackman%E2%80%93Nuttall_window
      
  | 
  inline | 
      
  | 
  inline | 
Blackman-Harris window function.
https://en.wikipedia.org/wiki/Window_function#Blackman%E2%80%93Harris_window
      
  | 
  inline | 
| DEPRECATED typedef VuMeter rack::dsp::VUMeter | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static |