syncPulsDel

Generates a delayable synced pulse after a rising trigger on the trig input The pulse-length depends on the time in-between triggers on the "sync" input, the "steps" input and the "stop" knob. The time of the sync is multiplied with the steps to set the maximum trigger length, the "stop" knob sets the amount of that time the gate will be high. This pulse is given after a synced delay time. The "start" knob sets a maximum of four times the "sync time"
Author: Remco van der Most
License: BSD
Github: sss/timing/syncPulsDel.axo

Inlets

bool32.rising trigger

bool32 sync

int32 steps

Outlets

bool32 pulse output

Parameters

frac32.u.map start

frac32.u.map stop

Declaration
uint32_t val1;
uint32_t val2;
bool ntrig;
bool trg;
uint32_t timer;
Init
val1 = 0;
val2 = 0;
ntrig = 0;
Control Rate
if ((inlet_sync > 0) && !ntrig) {
  ntrig = 1;
  timer = val1 * 0.9;
  val1 = 0;
} else if (!(inlet_sync > 0)) {
  ntrig = 0;
}

if ((inlet_trig > 0) && !trg) {
  trg = 1;
  val2 = -___SMMUL(param_start << 3, timer << 4);
} else if (!(inlet_trig > 0)) {
  trg = 0;
}
val1 += 1;
val2 += 1;
outlet_out = ((val2 / inlet_steps) < ___SMMUL(param_stop << 3, timer << 2)) &&
             ((val2) > 0);

Privacy

© 2024 Zrna Research