nestEarlyR

Nested early reflections module. Put the name of a delayline module into the reference box to add early reflections to the delayline.
Author: Remco van der Most
License: BSD
Github: sss/delay/nestEarlyR.axo

Inlets

frac32buffer wave input

Outlets

None

Parameters

frac32.u.map main spread size of delaytimes

frac32.s.map exponential spreading of delaytimes

frac32.s.map S-curve/inv-S-curve spreading of delaytimes

frac32.s.map volume shape of early reflections

frac32.s.map main volume reflections

Attributes

combo size

objref delay

Declaration
static const uint32_t LENGTHPOW = (attr_size);
static const uint32_t LENGTH = (1 << attr_size);
static const uint32_t LENGTHMASK = ((1 << attr_size) - 1);
int16_t *array;
uint32_t writepos;
Init
static int16_t _array[attr_poly][1 << attr_size]
    __attribute__((section(".sdram")));
array = &_array[parent->polyIndex][0];
int i;
writepos = 0;
for (i = 0; i < LENGTH; i++)
  array[i] = 0;
Control Rate
int32_t d[3], t[3];
for (int i = 0; i < 3; i++) {

  int32_t T = (1 << 25) * (1 + i);
  T = T + ((i - 1) * param_curve >> 2);
  if (param_expo > 0) {
    T += ___SMMUL((1 << 27) - T, param_expo) << 5;
  } else {
    T -= ___SMMUL(T, -param_expo) << 5;
  }

  t[i] = ___SMMUL(param_spread, T) >> 22 - LENGTHPOW;

  int32_t D = param_vol;
  if (i == 0) {
    D -= ___SMMUL(D, param_damp + (1 << 27)) << 3;
  } else if (i == 1) {
    D = ___SMMUL(D,
                 (1 << 28) - ((param_damp > 0 ? param_damp : -param_damp) >> 1))
        << 4;
  } else {
    D -= ___SMMUL(D, -param_damp + (1 << 27)) << 3;
  }
  d[i] = D;
}

int32_t POS = attr_delay.writepos - BUFSIZE - 2;
Audio Rate
array[writepos] = __SSAT(inlet_in >> 14, 16);

attr_delay.array[(POS)&attr_delay.LENGTHMASK] =
    __SSAT((___SMMUL(array[(writepos - t[0]) & LENGTHMASK] << 5, d[0]) +
            ___SMMUL(array[(writepos - t[1]) & LENGTHMASK] << 5, d[1]) +
            ___SMMUL(array[(writepos - t[2]) & LENGTHMASK] << 5, d[2])) +
               attr_delay.array[(POS)&attr_delay.LENGTHMASK],
           16);
POS = (POS + 1) & attr_delay.LENGTHMASK;
writepos = (writepos + 1) & LENGTHMASK;

Privacy

© 2024 Zrna Research