nativeSaw

saw wave oscillator with "active" control Non-bandwith limited, medium quality
Author: Johannes Taelman(editted by Remco van der Most)
License: BSD
Github: sss/osc/nativeSaw.axo

Inlets

frac32.bipolar pitch

bool32 active

Outlets

frac32buffer.bipolar saw wave, non-anti-aliased

Parameters

frac32.s.map.pitch pitch

Declaration
int32_t osc_p;
Init
osc_p = 0;
Control Rate
if (inlet_active > 0) {
  uint32_t freq;
  MTOFEXTENDED(param_pitch + inlet_pitch, freq);
  int32_t f0i = 0x7fffffff / (1 + ((int)freq) >> 11);
  int j;
  for (j = 0; j < BUFSIZE; j++) {
    int32_t p1 = osc_p;
    int32_t p2 = p1 + freq;
    osc_p = p2;
    if ((p2 < 0) && (p1 > 0))
      outlet_wave[j] = ___SMMLS(f0i, p2 & ~(1 << 31), 0x200) << 15;
    else
      outlet_wave[j] = p2 >> 7;
  }
}
Audio Rate
if (inlet_active == 0) {
  outlet_wave = 0;
}

Privacy

© 2024 Zrna Research