diracExpo

nonlinear shaper. Outcoming waveforms have a lot in common with their analogue counterparts. code makes an exponential and inverse exponential copy of the signal. the difference between the newest and previous sample is used to mix either from original to exponential or from original to inverse exponential, depending on the sign of the difference. Range-control is bipolar, so the exponential and inverted exponential shaping process can be switch between before-peak or after-peak.
Author: Remco van der Nost
License: BSD
Github: sss/dist/diracExpo.axo

Inlets

frac32buffer in

frac32buffer aRange

frac32 kRange

Outlets

frac32buffer out

Parameters

frac32.s.map range

Declaration
int32_t diff;
int32_t prev;
int32_t pdiff;
int32_t ndiff;
int32_t positive;
int32_t negative;
int32_t mix;
int32_t norm;
int32_t val;
Audio Rate
val = val + ((inlet_in - val) >> 1);

int32_t range = __SSAT(param_range + inlet_kRange + inlet_aRange, 28);
diff = ___SMMUL(__SSAT((val - prev), 24) << 7, range << 4);
pdiff = diff > 0 ? diff : 0;
ndiff = diff < 0 ? -diff : 0;
pdiff = pdiff > (1 << 27) ? (1 << 27) : pdiff;
ndiff = ndiff > (1 << 27) ? (1 << 27) : ndiff;
positive = (inlet_in >> 1) + (1 << 26);
negative = (inlet_in >> 1) - (1 << 26);
positive = ___SMMUL(positive << 3, positive << 2);
positive = ___SMMUL(positive << 3, positive << 2);
positive = ___SMMUL(positive << 3, positive << 2) - (1 << 26);
negative = ___SMMUL(negative << 3, negative << 2);
negative = ___SMMUL(negative << 3, negative << 2);
negative = (1 << 27) - ___SMMUL(negative << 3, negative << 2) - (1 << 26);

norm = (1 << 27) - pdiff - ndiff;
mix = ___SMMUL(norm << 2, inlet_in << 2) + ___SMMUL(pdiff << 3, negative << 2) +
      ___SMMUL(ndiff << 3, positive << 2);
outlet_out = mix;
// outlet_out=negative;

prev = val;

Privacy

© 2024 Zrna Research