phaserST

Stereo phaser Up to 8 read points from a stereo buffer. Left and right are inversely modulated. Spread controls the phase-offset of the modulating sines of the seperate stages. This enables lots of different modulation charaters. Note though, output can get loud! I advice a distortion or compressor behind this module (depending on needed character: aggresive/clean)
Author: Remco van der Most
License: BSD
Github: sss/fx/phaserST.axo

Inlets

frac32buffer wave input

frac32buffer inR

frac32 rate

frac32 depth

frac32 spread

Outlets

frac32buffer outL

frac32buffer outR

Parameters

frac32.u.map depth

frac32.u.map spread

frac32.u.map.gain wet

frac32.u.map.gain dry

int32 stages

frac32.s.map feed

frac32.s.map.kpitch rate

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);
int16_t *array;
uint32_t writepos;
int32_t tmp_r;
int32_t phase;
int32_t v26 = (1 << 26);
int32_t v30 = (1 << 30);
int i;
int32_t read(int32_t Ps, int32_t I) {
  uint32_t tmp_d = Ps;
  uint32_t tmp_di = writepos - (tmp_d >> (27 - LENGTHPOW)) - 1;
  uint32_t tmp_w1 = (tmp_d << (LENGTHPOW + 3)) & 0x3FFFFFFF;
  uint32_t tmp_w2 = v30 - tmp_w1;
  int32_t tmp_a1 = array[(tmp_di & LENGTHMASK) + I] << 16;
  int32_t tmp_a2 = array[((tmp_di + 1) & LENGTHMASK) + I] << 16;
  tmp_r = ___SMMUL(tmp_a1, tmp_w1);
  return tmp_r = ___SMMLA(tmp_a2, tmp_w2, tmp_r);
}
int32_t feedL;
int32_t feedR;
Init
static int16_t _array[1 << attr_size + 1] __attribute__((section(".sdram")));
array = &_array[0];
int i;
writepos = 0;
for (i = 0; i < (LENGTH << 1); i++)
  array[i] = 0;
Control Rate
int32_t freq;
MTOFEXTENDED(param_rate + inlet_rate, freq)
freq = freq >> 12;
int32_t depth = __USAT(param_depth + inlet_depth, 27) >> 1;
int32_t spread = (param_spread + inlet_spread) / param_stages << 5;
int32_t DP = (depth > 0 ? depth : -depth) >> 1;
Audio Rate
outlet_outL = ___SMMUL(param_dry, inlet_inL);
outlet_outR = ___SMMUL(param_dry, inlet_inR);

writepos = (writepos + 1) & LENGTHMASK;
array[writepos] =
    __SSAT(inlet_inL + ___SMMUL(param_feed << 3, feedR << 2) >> 14, 16);
array[writepos + LENGTH] =
    __SSAT(inlet_inR + ___SMMUL(param_feed << 3, feedL << 2) >> 14, 16);

phase += freq;
for (i = 0; i < param_stages; i++) {
  int32_t sine;
  SINE2TINTERP(phase + (i * spread), sine)
  sine = ___SMMUL(sine, depth);
  feedL = read(DP + sine, 0);
  feedR = read(DP - sine, LENGTH);
  outlet_outL += ___SMMUL(feedL << 1, param_wet) / param_stages;
  outlet_outR += ___SMMUL(feedR << 1, param_wet) / param_stages;
}

Privacy

© 2024 Zrna Research