forbac m

Modulable Forward Backward noise generator
Author: Smashed Transistors
License: LGPL
Github: tiar/noise/forbac_m.axo

Inlets

frac32 cycle

Outlets

frac32buffer.bipolar pink noise

Parameters

frac32.u.map cycle

int32 offset

int32 jitter

bool32.tgl invert

Declaration
int32_t inv; // -1 if invert needed
// inv =  1  =>   F B F B
//                / \ / \
//
// inv = -1  =>   F B-F-B
//                / \
//                    \ /
int32_t c;
int32_t r;
int32_t r2;
int32_t s;

int32_t newCycle = 8;
Init
r = GenerateRandomNumber();
c = 0;
r2 = 137;
s = 1 << (32 - 4);
Control Rate
{
  int32_t c = (int32_t)__USAT(param_cycle + inlet_cycle, 27);
  uint32_t fc = (c & ((1 << 23) - 1)) << (32 - 23);
  newCycle = (c >> 23) + (fc > (r2 = r2 * 69069 + 1));
}
inv = param_invert ? -1 : 1;
int32_t resetValue =
    ___SMMLA(r2 = r2 * 69069 + 1, param_jitter, newCycle + param_offset);
Audio Rate
c--;
if (c <= -newCycle) {
  c = resetValue;
  s *= inv;
}
r = (c <= 0 ? -1511872763 * (r - 1) : 69069 * r + 1);
outlet_out = ___SMMUL(s, r);

Privacy

© 2024 Zrna Research