0x k

Detects the number of samples between zero crossings, and when a zero crossing occurs trig outputs a pulse.
Author: Sputnki
License: BSD
Github: sptnk/detect/0x k.axo

Inlets

frac32.bipolar in

Outlets

int32 number of samples at k-rate sample rate

bool32.pulse a pulse is fired when the zero crossing occurs

Declaration
uint32_t count = 0;
uint32_t output = 0;

bool sign_old = 0;
bool sign = 0;
Control Rate
count++;
sign = inlet_in > 0 ? 1 : 0;
bool trig = 0;

if (sign != sign_old) {
  output = count;
  count = 0;
  trig = 1;
}

outlet_smp = output;
outlet_trig = trig;
sign_old = sign;

Privacy

© 2024 Zrna Research