saw medium

saw wave oscillator Non-bandwith limited, medium quality
Author: Johannes Taelman
License: BSD
Github: osc/saw medium.axo

Inlets

frac32.bipolar pitch

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
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;
}

Privacy

© 2024 Zrna Research