gateEuclid

euclidian gate generator with multiple outs (n-outputs are inverted gates of the other outputs) maxcount set the base for the repeat/start/width controls. Normally this would be the same value as the maximum count of the counter, but this can also be controlled independently if you want to set a smaller base then the max-count. repeat A and B set the size of the euclidian repetition respective to the maxcount input. start A and B offset the position of the euclidian repetition respective to the repetition size. width A and B set the gate length within each euclidian repetition respective to the repetition size.
Author: Remco van der Most
License: BSD
Github: sss/patt/gateEuclid.axo

Inlets

int32 nominator

int32 maxcount

frac32 repeatA

frac32 startA

frac32 widthA

frac32 repeatB

frac32 startB

frac32 widthB

Outlets

bool32 A

bool32 nA

bool32 B

bool32 nB

bool32 X

bool32 nX

bool32 O

bool32 nO

Control Rate
int32_t a;
int32_t repeatA = ___SMMUL(inlet_repeatA << 3, inlet_maxcount << 2);
int32_t repeatB = ___SMMUL(inlet_repeatB << 3, inlet_maxcount << 2);
a = inlet_count - ___SMMUL(inlet_startA << 3, repeatA << 2);
int32_t r;
if (a >= 0)
  r = ((unsigned int)a) / repeatA;
else
  r = -(((unsigned int)(repeatA - a)) / repeatA);
int32_t Rem = a - (r * repeatA);
outlet_A = Rem < ___SMMUL(inlet_widthA << 3, repeatA << 2) ? 1 : 0;
outlet_nA = !outlet_A;
a = a + ___SMMUL(inlet_startB << 3, repeatB << 2);
if (a >= 0)
  r = ((unsigned int)a) / repeatB;
else
  r = -(((unsigned int)(repeatB - a)) / repeatB);
Rem = a - (r * repeatB);
outlet_B = Rem < ___SMMUL(inlet_widthB << 3, repeatB << 2) ? 1 : 0;
outlet_nB = !outlet_B;
outlet_X = outlet_A & outlet_B;
outlet_nX = !outlet_X;
outlet_O = outlet_A || outlet_B;
outlet_nO = !outlet_O;

Privacy

© 2024 Zrna Research