subSine

sub-sine wave oscillator Generates 2 sines that can be overdriven into square-waves.
Author: Remco van der Most
License: BSD
Github: sss/osc/subSine.axo

Inlets

frac32buffer frequency

frac32 phase

frac32.bipolar pitch

Outlets

frac32buffer.bipolar sine wave

Parameters

frac32.s.map.pitch pitch

frac32.u.map drive1

frac32.u.map drive2

Declaration
uint32_t Phase;
Init
Phase = 0;
Control Rate
int32_t freq;
MTOFEXTENDED(param_pitch + inlet_pitch, freq);
Audio Rate
Phase += freq + inlet_freq;
int32_t r;
int32_t p2 = Phase + (inlet_phase << 4);
SINE2TINTERP(Phase, r)
r = (r >> 5);
int32_t ts = __SSAT(r + ___SMMUL(r << 3, param_drive1 << 3), 28);
int32_t tsq31 = ts << 3;
int32_t tsq31p3 = ___SMMUL(tsq31, ___SMMUL(tsq31, tsq31));
r = __SSAT(ts + (ts >> 1) - (tsq31p3), 28);
ts = __SSAT(r + ___SMMUL(r << 3, param_drive1 << 3), 28);
tsq31 = ts << 3;
tsq31p3 = ___SMMUL(tsq31, ___SMMUL(tsq31, tsq31));
int32_t wave;
outlet_wave = __SSAT(ts + (ts >> 1) - (tsq31p3) >> 2, 26);

SINE2TINTERP(p2 << 1, r)
r = (r >> 5);
int32_t Ts = __SSAT(r + ___SMMUL(r << 3, param_drive2 << 3), 28);
int32_t Tsq31 = Ts << 3;
int32_t Tsq31p3 = ___SMMUL(Tsq31, ___SMMUL(Tsq31, Tsq31));
r = __SSAT(Ts + (Ts >> 1) - (Tsq31p3), 28);
Ts = __SSAT(r + ___SMMUL(r << 3, param_drive2 << 3), 28);
Tsq31 = Ts << 3;
Tsq31p3 = ___SMMUL(Tsq31, ___SMMUL(Tsq31, Tsq31));

outlet_wave += __SSAT(Ts + (Ts >> 1) - (Tsq31p3) >> 2, 26);

Privacy

© 2024 Zrna Research