sphasor mul

saw wave signal-rate LFO, rising slope, sample input. 48000 at inlet 'smps' will result in a 1hz-saw-wave. inlet 'mul' sets a multiplier.
Author: robert schirmer
License: who cares
Github: rbrt/osc/sphasor mul.axo

Inlets

frac32 multiplier

bool32.rising reset phase

int32 samples in

Outlets

frac32buffer wave

Declaration
uint32_t Phase;
uint64_t freq;
uint32_t r;
Init
Phase = 0;
r = 1;
Audio Rate
if (inlet_smps) {
  freq =
      (___SMMUL(inlet_mul, (int)(281474976710656.f / (inlet_smps * (128 << 3))))
       << 5);
} else
  freq = 0;

{
  if (inlet_reset && r) {
    Phase = 0;
    r = 0;
  } else {
    if (!inlet_reset)
      r = 1;
    Phase += freq >> 6;
  }
  outlet_wave = (Phase >> 5);
}

Privacy

© 2024 Zrna Research