frac32.bipolar in
int32 number of samples at k-rate sample rate
bool32.pulse a pulse is fired when the zero crossing occurs
frac32.positive frequency
float count = 0;
float output = 0;
bool sign_old = 0;
bool sign = 0;
int32_t in_prev = 0;
count += 1.0f;
sign = inlet_in > 0 ? 1 : 0;
float intercept = ((float)inlet_in) / ((float)(in_prev - inlet_in));
bool trig = 0;
if (sign != sign_old) {
output = count + intercept;
count = -intercept;
trig = 1;
}
in_prev = inlet_in;
outlet_smp = output;
outlet_trig = trig;
sign_old = sign;
outlet_f = 2147483648.0f / output;