nativeSuperSaw

seven detuned saw wave oscillators with "active" control and extra "phase" modulation/destruction inlet (guess the audio rate modulation is converted to k-rate because of the blep-code, though modulation can be quite fat still). Non-bandwith limited
Author: Johannes Taelman (editted by Remco van der Most)
License: BSD
Github: sss/osc/nativeSuperSaw.axo

Inlets

frac32.bipolar pitch

frac32.bipolar detune

frac32buffer phase

bool32 active

Outlets

frac32buffer.bipolar supersaw wave

Parameters

frac32.s.map.pitch pitch

frac32.u.map detune

Declaration
int32_t osc_p[7];
int32_t p2;
int32_t p1;
Init
int i;
for (i = 0; i < 7; i++)
  osc_p[i] = i << 28;
Control Rate
if (inlet_active > 0) {

  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++) {
      p1 = osc_p[i];
      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;
    }
  }
}
Audio Rate
int i;
for (i = 0; i < 6; i++) {
  osc_p[i] = osc_p[i] + (inlet_phase << 5);
}
if (inlet_active == 0) {
  outlet_wave = 0;
}

Privacy

© 2024 Zrna Research