s2f

converts samples to units suitable for setting the frequency of oscillators.
Author: robert schirmer
License: who cares
Github: rbrt/math/s2f.axo

Inlets

int32 samples in

Outlets

frac32 frequency out

Control Rate
if (inlet_smps) {
  if (inlet_smps < (1 << 21))
    outlet_freq = (int)(281474976710656.f / (inlet_smps * (128 << 3)));
  else
    outlet_freq = (281474976710656 >> 10) / ((inlet_smps >> 10) * (128 << 3));
} else
  outlet_freq = 0;

Privacy

© 2024 Zrna Research