noisqr

Author: Smashed Transistors
License: LGPL
Github: tiar/noise/noisqr.axo

Inlets

bool32.rising newSeed

Outlets

frac32buffer.bipolar ring

Parameters

int32 nbOsc

Declaration
static const int NB = 8;
int16_t p[NB];
int16_t c[NB];
int32_t s[NB];

int32_t r;

bool _newSeed;
Init
for (int j = 0; j < NB; j++) {
  c[j] = 0;
  s[j] = 1;
}
r = GenerateRandomNumber();
for (int i = 0; i < NB; i++) {
  r = r * 69069 + 1;
  p[i] = 150 + (r >> (31 - 7)); // +-128
}
_newSeed = false;
Control Rate
if (!_newSeed && inlet_newSeed) {
  for (int i = 0; i < NB; i++) {
    r = r * 69069 + 1;
    p[i] = 150 + (r >> (31 - 7)); // +-128
  }
}
_newSeed = inlet_newSeed;
Audio Rate
int32_t r = 1;
for (int i = 0; i < param_nbOsc; i++) {
  if (c[i]-- <= 0) {
    c[i] = p[i];
    s[i] = -s[i];
  }
  r *= s[i];
}
outlet_ring = r << 26;

Privacy

© 2024 Zrna Research