polySpread

Outputs a value evenly spread between -64 and +64, depending on the current voice number - e.g. for 3 voices, the output would be -64, 0, +64. For 5 voices it would be -64, -32, 0, 32, 64 and so on. For the straight distribution, the output will be ordered: The lowest voice will output the lowest value, stepping up to the next value as the voice number increases. For the random distribution, the possible values are randomly distributed to each voice when the patch loads.
Author: Johannes Elliesen
License: GPL
Github: TSG/patch/polySpread.axo

Inlets

None

Outlets

frac32.bipolar spread

Attributes

combo distribution

Declaration
int32_t output[attr_poly];
Init
// assign outputs for an even spread.
for (int i = 0; i < attr_poly; i++) {
  output[i] = ((128 << 21) / (attr_poly - 1)) * i - (64 << 21);
}

// shuffle for random spread
#if attr_distribution == 1
for (int i = attr_poly; i > 1; i--) {
  int32_t random = GenerateRandomNumber() % i;
  int32_t tmp = output[i - 1];
  output[i - 1] = output[random];
  output[random] = tmp;
}
#endif
Control Rate
outlet_spread = output[parent->polyIndex];

Privacy

© 2024 Zrna Research