sintri

sine wave oscillator
Author: Johannes Taelman
License: BSD
Github: sss/osc/sintri.axo

Inlets

frac32.bipolar pitch

frac32 shape

Outlets

frac32buffer.bipolar sine wave

Parameters

frac32.s.map.pitch pitch

frac32.u.map shape

Declaration
uint32_t Phase;
int32_t prev1;
int32_t step1;
int32_t prev2;
int32_t step2;
int rtrig;
int32_t SQ;
int32_t sq;
Init
Phase = 0;
SQ = 0;
Control Rate
int32_t freq;
MTOFEXTENDED(param_pitch + inlet_pitch, freq);
int32_t shape = inlet_shape + param_shape;
shape = shape & ((1 << 28) - 1);
shape = shape > (1 << 27) ? (1 << 28) - shape : shape;
step1 = (shape - prev1) >> 4;
int32_t i1 = prev1;
prev1 = shape;
step2 = (freq - prev2) >> 4;
int32_t i2 = prev2;
prev2 = freq;
Audio Rate
i1 += step1;
i2 += step2;
Phase += i2;
int32_t r1;
int32_t r2;
int32_t p2 = Phase;
SINE2TINTERP(p2, r1)
r2 = Phase + (1 << 30);
r2 = r2 > 0 ? r2 : -r2;
r2 = (r2) - (1 << 30);
outlet_wave =
    (___SMMUL((r1 >> 1), ((1 << 27) - i1) << 2) + ___SMMUL(r2, i1 << 2)) >> 2;

Privacy

© 2024 Zrna Research