bitPeak

Attenuates the incoming signal and uses the smallest bit to add a positive/negative value depending on input sign. Then adds this to the original signal.
Author: Remco van der Most
License: BSD
Github: sss/dist/bitPeak.axo

Inlets

frac32buffer i1

frac32 rate

frac32 slope

frac32 amt

frac32 tresh

Outlets

frac32buffer o1

Parameters

frac32.s.map rate

frac32.s.map slope

frac32.u.map amt

frac32.u.map tresh

Declaration
int32_t val;
int32_t vel;
Control Rate
int32_t f1;
int32_t f2;
MTOF(param_slope + param_rate + inlet_slope + inlet_rate, f1)
MTOF(-param_slope + param_rate - inlet_slope + inlet_rate, f2)
f1 = f1;
f2 = f2;
int32_t tresh = __USAT(param_tresh + inlet_tresh + 4, 27);
tresh = ___SMMUL(tresh << 3, tresh << 2);
tresh = ___SMMUL(tresh << 3, tresh << 2);
int32_t amt = __USAT(param_amt + inlet_amt, 27);
Audio Rate
if ((inlet_i1 / tresh) & 1) {
  if (inlet_i1 > 0) {
    val += f1;
    val = val > amt ? amt : val;
  } else {
    val -= f2;
    val = val < -amt ? -amt : val;
  }
}
vel += val - vel >> 2;
outlet_o1 = inlet_i1 - (vel >> 2);

Privacy

© 2024 Zrna Research