slowsquare

square wave LFO, boolean output, frequency input with octave inlet added to oct parameter
Author: Johannes Taelman
License: BSD
Github: phi/lfo/slowsquare.axo

Inlets

frac32.bipolar pitch

int32.positive oct

bool32.rising reset phase

Outlets

bool32 square wave

Parameters

frac32.s.map.lfopitch pitch

int32 oct

Declaration
int32_t Phase;
uint32_t r;
Init
Phase = 0;
r = 1;
Control Rate
{
  if (inlet_reset && r) {
    Phase = 0;
    r = 0;
  } else {
    if (!inlet_reset)
      r = 1;
    int32_t freq;
    MTOFEXTENDED(param_pitch + inlet_pitch, freq);
    Phase += (freq >> param_oct);
  }
  outlet_wave = (Phase > 0) ? 1 : 0;
}

Privacy

© 2024 Zrna Research