bool32.rising when triggered steps in the array get randomised controlled by chance/change settings
int32 input for the counter (logic->counter)
int32 maximum count (eg. use my counter modules as these have in/outs for the length set)
int32 external randomise chance input
frac32 external change size input
frac32 external control for max output value
frac32 external control for min output value
frac32 v
bool32.pulse rnd
frac32.u.map sets a repeat length within zero and the "length" input/max array size. 32 would be half way the length. 22 would select 1/3 of the length input/max array size.
frac32.u.map change-size from current value when a step is randomised
frac32.u.map Sets a chance of a random offset added to the pattern. This offset is not put into the memory and occurs only once.
frac32.u.map Sets the size of the random offset away from the repeating pattern.
frac32.u.map Sets the chance that the output freezes for a random amount of counts
frac32.u.map Sets the maximum amount of counts that the output can be frozen
frac32.u.map move the CV knob to auto-record the values of the knob to the pattern
int32 chance that steps get randomised when a trigger is received at the input
bool32.mom press to randomise pattern
frac32.s.map maximum output value
frac32.s.map minimum output value
spinner maxSteps
int get[attr_maxSteps];
uint32_t val[attr_maxSteps];
int ntrig;
int count;
int32_t length;
int i;
int on;
int prev;
int32_t Gen;
uint32_t pv;
int upd;
uint32_t Tmp;
on = 1;
ntrig = 0;
int chance = param_chance + inlet_chance;
int32_t change = param_change + inlet_change;
chance = chance < 0 ? 0 : chance;
chance = chance > 100 ? 100 : chance;
int trig = inlet_rnd + param_rnd;
int32_t width = param_max + inlet_max - param_min - inlet_min;
if (inlet_length > 0) {
length = ___SMMUL(param_repeat << 3, inlet_length + 1 << 2);
} else
length = param_repeat >> 21;
int TRIG = 0;
if ((trig > 0) && !ntrig) {
TRIG = 1;
int32_t size = change << 3;
for (i = 0; i < attr_maxSteps; i++) {
get[i] = (int32_t)(GenerateRandomNumber() % (100));
if (get[i] <= chance) {
val[i] +=
(___SMMUL((uint32_t)(GenerateRandomNumber() & ((1 << 31) - 1)), size)
<< 2) -
size;
val[i] = val[i] & ((1 << 31) - 1);
val[i] = val[i] > (1 << 30) ? (1 << 31) - val[i] : val[i];
}
}
ntrig = 1;
} else if (!(trig > 0))
ntrig = 0;
count = inlet_count - (inlet_count / length) * length;
if (!(count == pv)) {
upd = __USAT(upd - 1, 28);
Gen = ((uint32_t)(GenerateRandomNumber()) >> 5) < param_nonMemRnd ? 1 : 0;
if (Gen == 1) {
Gen = ___SMMUL(param_size, (int32_t)GenerateRandomNumber()) << 5;
}
if (upd == 0) {
upd = ((uint32_t)(GenerateRandomNumber()) >> 5) < param_freeze
? param_maxFreeze >> 23
: 0;
}
}
if (!(param_CV == prev)) {
val[count] = param_CV << 3;
}
if (upd == 0) {
Tmp = val[count] + Gen;
Tmp = Tmp & ((1 << 30) - 1);
}
outlet_v = (___SMMUL(Tmp >> 1, width) << 3) + param_min + inlet_min;
if (on > 0) {
for (i = 0; i < attr_maxSteps; i++) {
val[i] = (uint32_t)(GenerateRandomNumber() >> 2);
}
}
on = 0;
outlet_rnd = TRIG;
prev = param_CV;
pv = count;