supersaw

seven detuned saw wave oscillators Non-bandwith limited
Author: Johannes Taelman
License: BSD
Github: osc/supersaw.axo

Inlets

frac32.bipolar pitch

frac32.bipolar detune

Outlets

frac32buffer.bipolar supersaw wave

Parameters

frac32.s.map.pitch pitch

frac32.u.map detune

Declaration
int32_t osc_p[7];
Init
int i;
for (i = 0; i < 7; i++)
  osc_p[i] = i << 28;
Control Rate
uint32_t f0;
uint32_t f[6];
MTOFEXTENDED(param_pitch + inlet_pitch, f0);
uint32_t det1 = __USAT(param_detune + inlet_detune, 27);
uint32_t det = ___SMMUL(det1, det1);
uint32_t f0d = ___SMMUL(det << 8, f0);
int i, j;
f[0] = ___SMMLA(f0d, -0x54321230, f0);
f[1] = ___SMMLA(f0d, -0x31111110, f0);
f[2] = ___SMMLA(f0d, -0x10203040, f0);
f[3] = ___SMMLA(f0d, 0x10304500, f0);
f[4] = ___SMMLA(f0d, 0x32121210, f0);
f[5] = ___SMMLA(f0d, 0x55422110, f0);
int32_t f0i = 0x7fffffff / (1 + ((int)f0) >> 11);
for (j = 0; j < BUFSIZE; j++) {
  int32_t p1 = osc_p[6];
  int32_t p2 = p1 + f0;
  osc_p[6] = p2;
  if ((p2 < 0) && (p1 > 0))
    outlet_wave[j] = ___SMMLS(f0i, p2 & ~(1 << 31), 0x200) << 15;
  else
    outlet_wave[j] = p2 >> 7;

  for (i = 0; i < 6; i++) {
    int32_t p1 = osc_p[i];
    int32_t p2 = p1 + f[i];
    osc_p[i] = p2;
    if ((p2 < 0) && (p1 > 0))
      outlet_wave[j] += ___SMMLS(f0i, p2 & ~(1 << 31), 0x200) << 15;
    else
      outlet_wave[j] += p2 >> 7;
  }
}

Privacy

© 2024 Zrna Research