rndTapDelayStereoOut

random multi-tap delay/early reflections with controllable tap-amount. length sets the amount of taps.
Author: Remco van der Most
License: BSD
Github: sss/delay/rndTapDelayStereoOut.axo

Inlets

frac32 maximum

bool32.rising random

Outlets

frac32buffer wave

frac32buffer outR

Parameters

frac32.u.map maximum

frac32.u.map minimum

int32 length

bool32.mom random

Attributes

objref delayname

Declaration
int32_t _val[16];
int32_t _vol[16];
int32_t _pan[16];
int32_t _com[16];
int32_t _sam[16];
int ntrig;
int8_t lng;
int i;
uint32_t _delay[16];
int32_t sumL;
int32_t sumR;
int32_t mad;
int32_t mid;
Init
for (i = 0; i < 16; i++)
  _val[i] = (GenerateRandomNumber()) >> 5;
{}
for (i = 0; i < 16; i++)
  _vol[i] = (GenerateRandomNumber()) >> 5;
{}
for (i = 0; i < 16; i++)
  _pan[i] = (GenerateRandomNumber()) >> 5;
{}
for (i = 0; i < 16; i++)
  _com[i] = (1 << 27) - _pan[i];
{}
ntrig = 0;
Control Rate
lng = param_length;
int32_t width = param_maximum + inlet_maximum - param_minimum;

if (((param_random + inlet_random) >= 1) && (!(ntrig))) {
  for (i = 0; i < lng; i++)
    _val[i] = ((GenerateRandomNumber()) >> 5);
  {}
  for (i = 0; i < lng; i++)
    _vol[i] = ((GenerateRandomNumber()) >> 5);
  {}
  for (i = 0; i < lng; i++)
    _pan[i] = ((GenerateRandomNumber()) >> 5);
  {}
  for (i = 0; i < lng; i++)
    _com[i] = (1 << 27) - _pan[i];
  {}
  ntrig = 1;
} else if (!((param_random + inlet_random) >= 1)) {
  ntrig = 0;
}
Audio Rate
mad = mad + ((param_minimum - mad) >> 13);
mid = mid + ((width - mid) >> 1);
sumL = 0;
sumR = 0;
for (i = 0; i < lng; i++) {
  _delay[i] = attr_delayname.writepos -
              (__USAT(___SMMUL(mid << 3, (_val[i]) << 2) + mad, 27) >>
               (27 - attr_delayname.LENGTHPOW)) -
              BUFSIZE + buffer_index;
}

for (i = 0; i < lng; i++)
  _sam[i] =
      (___SMMUL(
          (attr_delayname.array[(_delay[i]) & attr_delayname.LENGTHMASK] << 14)
              << 3,
          _vol[i] << 2)) /
      (1 + lng / 2);
{}
for (i = 0; i < lng; i++)
  sumL += ___SMMUL((_sam[i]) << 3, (_pan[i]) << 4);
{}
for (i = 0; i < lng; i++)
  sumR += ___SMMUL((_sam[i]) << 3, (_com[i]) << 4);
{}
outlet_outL = sumL;
outlet_outR = sumR;

Privacy

© 2024 Zrna Research