rain

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

Inlets

None

Outlets

frac32buffer.bipolar out

Declaration
int32_t r;     // audio random
int32_t rdir;  // random direction
int32_t rdirf; // lp filtered random direction
int32_t rs;
Init
r = GenerateRandomNumber();
rdir = GenerateRandomNumber();
rs = GenerateRandomNumber();
Audio Rate
// rdirf = 0;

rdir = rdir * 69069 + 1;
rdirf = ___SMMLA(0x10000000, (rdir >> 2) - rdirf, rdirf);
if (rdirf > 0) {
  // forward
  r = r * 69069 + 1;
  outlet_out = r >> 4;
} else {
  // backward
  r = -1511872763 * (r - 1);
  outlet_out = -r >> 4;
}
if (rdir > 0x50000000) {
  if (rdir > 0x70000000)
    rs = rs * 69069 + 1;
  r = rs;
}

Privacy

© 2024 Zrna Research