pulselengthm

Generates a single pulse after after a rising edge on trigger input. A new trigger before the pulse ends at the output, will extend the pulse. This version has a modulation input for the delay time. Extended range.
Author: Johannes Taelman
License: BSD
Github: timer/pulselengthm.axo

Inlets

frac32.bipolar delay

bool32.rising trigger

Outlets

bool32 pulse output

Parameters

frac32.s.map.klineartime.exp delay

Declaration
int32_t val;
int ntrig;
Init
val = 0;
ntrig = 0;
Control Rate
if ((inlet_trig > 0) && !ntrig) {
  val = 1 << 30;
  ntrig = 1;
  outlet_pulse = 1;
} else {
  if (!(inlet_trig > 0))
    ntrig = 0;
  if (val > 0) {
    int32_t t;
    MTOF(-param_delay - inlet_delay, t);
    val -= t >> 3;
    if (val <= 0)
      outlet_pulse = 0;
    else
      outlet_pulse = 1;
  } else
    outlet_pulse = 0;
}

Privacy

© 2024 Zrna Research