clockswing3

adds swing to a trigger signal First gate/trigger is let through as a short trigger Second gate/trigger resets the internal counter and only generates a short trigger if the internal counter passes the swing value. Internal counter is at krate. Most swing values will be between 0 (no swing) and 200. If the swing value is so high that the counter will be reset before it has generated a trigger, it won't generate a trigger. So it's useful to add a reset signal (once every 64 steps? or more?) to both the swing module and the sequencer that you're providing the swing to.
Author: Remco van der Most
License: BSD
Github: sss/seq/clockswing3.axo

Inlets

bool32.rising uses a gate/trigger signal (eg for sequencers)

bool32 resets internal 1st/2nd trigger counter

int32 sets swing position (the higher the value, the later the 2nd trigger will be generated)

Outlets

bool32.pulse trigOut

Parameters

int32 swing

int32 repeat

int32 range

frac32.u.map in

Declaration
int array1[64];
int16_t cnt;
int cot;
int cat;
int ttrig;
int dtrig;
int swingOn;
int gtrig;
int16_t swingsize;
Init
cnt = 999;
Control Rate
int32_t repeat = param_repeat;
outlet_trigOut = 0;
cnt = __USAT(cnt - 1, 27);

if ((inlet_trigIn > 0) && (!(ttrig))) {
  swingsize =
      ___SMMUL((inlet_swing >> 15) / repeat << 3, param_in << 2) + param_swing;
  ttrig = 1;
  cnt = cot * swingsize + 1;
  cat += 1;
  cat = cat - cat / param_range * param_range;
  cot = cat - (cat / repeat) * repeat;

} else if (!(inlet_trigIn > 0)) {
  ttrig = 0;
}

outlet_trigOut = cnt == 1;

Privacy

© 2024 Zrna Research