trapezoidal window

Trapezoidal window
Author: Sputnki
License: BSD
Github: sptnk/math/trapezoidal window.axo

Inlets

frac32buffer in

Outlets

frac32buffer out

Parameters

frac32.u.map 0 = rectangular; 64 = triangle

Declaration
int32_t r1;
int32_t r2;
Control Rate
float halfsize = param_size >> 1;
float halfsize_compl = (1 << 27) - halfsize;

float ramp = (1 << 27) / halfsize;
Audio Rate
if (inlet_in < 0 || inlet_in > 1 << 27) {
  outlet_out = 0;
} else if (inlet_in < halfsize) {
  outlet_out = inlet_in * ramp;
} else if (inlet_in > halfsize_compl) {
  outlet_out = (1 << 27) - (inlet_in - halfsize_compl) * ramp;
} else
  outlet_out = 1 << 27;

Privacy

© 2024 Zrna Research