anaKick

Based on a stripped version of my mostFilter3 design, this emulates an impulse driven resonator. The impulse is an lfsr-burst with controllable polynomial and burst length, this should allow a fair amount of different clicks for your kick. The impulse is also used to drive the "hit" modulation of the pitch. Tail is the resonance of the filter, which is set to a really low damping for a longer resonance tail.
Author: Remco van der Most
License: BSD
Github: sss/edrum/anaKick.axo

Inlets

frac32 trig

frac32 pitch

frac32 tail

int32 polynomial

int32 burst

Outlets

frac32buffer out

Parameters

frac32.u.map.gain gain

frac32.u.map.gain hit

frac32.s.map.pitch pitch

frac32.u.map tail

int32 polynomial

int32 burst

Declaration
int32_t pos;
int32_t spd;
int32_t v27 = 1 << 27;
int32_t prv;
int32_t th;
int32_t lp;
int32_t burst;
uint32_t state;
int32_t count;
int32_t ntrig;
int32_t lvl;
int32_t vi10 = (1 << 10) - 1;
Init
state = 0;
count = 0;
ntrig = 0;
burst = 0;
Control Rate
int32_t damp = (int32_t)((v27 - __USAT(param_tail + inlet_tail, 27) * 0.99))
               << 3;
int32_t qnt = param_burst + inlet_burst;
qnt = qnt - qnt / 9 * 9;
qnt += qnt < 0 ? 10 : 1;
qnt = (1 << qnt) - 1;
if ((inlet_trig > 0) && !ntrig) {
  state = 1;
  count = qnt;
  ntrig = 1;
  lvl = inlet_trig;
} else {
  if (!(inlet_trig > 0))
    ntrig = 0;
}
int32_t polynomial = (inlet_polynomial + param_polynomial) & vi10;
Audio Rate
if (count > 0) {
  count--;
  if (state & 1) {
    state = (state >> 1) ^ polynomial;
    burst = lvl;
  } else {
    state = (state >> 1);
    burst = -lvl;
  }
} else
  burst = 0;

int32_t in;
int32_t ts = __SSAT(burst, 28);
int32_t tsq31 = ts << 3;
int32_t tsq31p3 = ___SMMUL(tsq31, ___SMMUL(tsq31, tsq31));
in = ts + (ts >> 1) - (tsq31p3);
int32_t frq;
MTOF(__SSAT(param_pitch + inlet_pitch + ___SMMUL(burst << 2, param_hit), 29),
     frq)
frq = frq >> 5;
lp += ___SMMUL((in - lp) << 1, frq << 1) << 1;
int32_t Tmp;
Tmp = lp - in;
int32_t LP = in + (Tmp >> 1);
spd += ___SMMUL((LP - pos), frq) << 3;
pos += spd;
int32_t dp = LP - pos;
dp = dp > 0 ? dp : -dp;
dp = dp >> 2;
dp = ___SMMUL(dp, ___SMMUL(dp, dp) << 5) << 5;
pos -= ___SMMUL(pos, __USAT(dp, 26)) << 5;
pos -= ___SMMUL(pos, __USAT(damp, 30)) >>
       6; // set 6 to an even higher number to create longer tails
int32_t out;
ts = __SSAT(pos + ___SMMUL(param_gain, pos << 2), 28);
tsq31 = ts << 3;
tsq31p3 = ___SMMUL(tsq31, ___SMMUL(tsq31, tsq31));
out = ts + (ts >> 1) - (tsq31p3);
outlet_out = out >> 1;
prv = spd;

Privacy

© 2024 Zrna Research