multiChorus

multi-stage chorus up to 16 stages. rate: the base rate of the internal LFO's for controlling the delaytime drift: offsetting the rate of the seperate LFO's for changing chorus characteristics mod: the rate of the internal LFO for modulating the frequency of the former LFO's FMW: the width of the LFO modulating the frequency stack: sets amount of chorus-taps phase: sets the starting phase of the LFO's modulating the chorus taps. phsSprd: sets the phase spreading of the LFO's modulating the chorus taps (fully clockwise is equal spreading for any amount of selected chorus taps. Counter clockwise is no spreading) depth: sets the modulation depth of the chorus spread: spreads the seperate chorus taps over the available delay length (when depth is fully open, there is no spreading possible as it's already using the full length of the delay) feed: amount of feedback of the output back to the input smooth: smooths out the chorus modulation (krate LP-filter)
Author: remco van der most
License: BSD
Github: sss/fx/multiChorus.axo

Inlets

frac32buffer wave input

frac32 phase

bool32 reset

Outlets

frac32buffer out

Parameters

int32 stack

int32 smooth

frac32.u.map depth

frac32.u.map spread

frac32.s.map.kpitch rate

frac32.s.map.kpitch mod

frac32.s.map FMW

frac32.s.map drift

frac32.s.map phase

frac32.s.map phsSprd

frac32.s.map feed

bool32.mom reset

Attributes

combo size

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);
int32_t *array;
uint32_t writepos;
uint32_t phase[32];
int i;
int32_t freq;
int64_t sine[32];
int32_t sum;
int32_t val[32];
int rtrig;
int32_t mod;
int32_t FMphase;
int32_t FMsine;
Init
static int32_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
MTOFEXTENDED(param_mod, mod)
FMphase += mod >> 7;
SINE2TINTERP(FMphase, FMsine)

MTOFEXTENDED(param_rate, freq)

if (((param_reset + inlet_reset) > 0) && !rtrig) {
  for (i = 0; i < param_stack; i++) {
    phase[i] = 0;
  }
  rtrig = 1;
} else if (param_reset + inlet_reset < 1) {
  rtrig = 0;
}

for (i = 0; i < param_stack; i++) {
  phase[i] += ((freq + ___SMMUL(i * freq << 2, param_drift << 3) +
                ___SMMUL(param_FMW, FMsine)) >>
               7);

  SINE2TINTERP(
      phase[i] +
          ((i * param_phsSprd / param_stack + param_phase + inlet_phase) << 4),
      sine[i])

  sine[i] = ((___SMMUL((sine[i] >> 1) + (1 << 30), param_depth << 4) << 1) +
             (___SMMUL(((1 << 27) - param_depth), (i * param_spread)) << 4));
}
Audio Rate
writepos = (writepos + 1) & LENGTHMASK;
array[writepos] = inlet_in + ___SMMUL(param_feed << 4, sum << 4) / param_stack;
sum = 0;
for (i = 0; i < param_stack; i++) {
  val[i] = val[i] + ((sine[i] - val[i]) >> param_smooth);
  sum += array[(writepos - ((val[i]) >> 32 - LENGTHPOW) & LENGTHMASK)] >> 2;
}

outlet_out = sum + inlet_in >> 2;

Privacy

© 2024 Zrna Research