sRndEuclidPatt

random gate pattern generator connect "COUNT" to a counter (sss-logic) connect "LENGTH" to the max-count control width1 sets the width of the random sequence REPEAT sets an euclidian division over the entire length. The smaller the value, the smaller the steps->more gates. Width sets the width of the gates, being added to the random sequence.
Author: Remco van der Most
License: BSD
Github: sss/patt/sRndEuclidPatt.axo

Inlets

bool32.rising rnd

int32 count

int32 length

Outlets

frac32 rand

Parameters

bool32.mom rand

frac32.s.map width1

frac32.s.map width2

frac32.u.map repeat

Declaration
int32_t _val[128];
int32_t vol;
int ntrig;
int8_t lng;
int i;
Init
for (i = 0; i < 64; i++)
  _val[i] = (GenerateRandomNumber()) >> 4;
{}
ntrig = 0;
Control Rate
int32_t repeat = ___SMMUL(param_repeat << 3, inlet_length << 2);
int32_t gtrig = inlet_count - ((inlet_count / repeat) * repeat);
gtrig = gtrig == 0 ? (1 << 27) : 0;

lng = inlet_length;
if (((param_rand + inlet_rnd) > 0) && (!(ntrig))) {
  for (i = 0; i < lng; i++)
    _val[i] = (GenerateRandomNumber()) >> 4;
  {}
  ntrig = 1;
} else if (!((param_rand + inlet_rnd) > 0)) {
  ntrig = 0;
}
vol = _val[inlet_count];
outlet_rand = ___SMMUL(vol << 2, param_width1 << 2) +
              ___SMMUL(gtrig << 3, param_width2 << 2);

Privacy

© 2024 Zrna Research