coseg sqr

Author: Smashed Transistors
License: LGPL
Github: tiar/osc/coseg sqr.axo

Inlets

frac32.bipolar pitch

frac32.bipolar brill

frac32.bipolar dissym

Outlets

frac32buffer.bipolar wave

Parameters

frac32.s.map.pitch pitch

frac32.u.map brill

frac32.u.map dissym

Declaration
uint32_t p, dp;
uint32_t gain;
Init
p = 0;
Control Rate
MTOFEXTENDED(param_pitch + inlet_pitch, dp);
MTOFEXTENDED(-param_pitch - inlet_pitch, gain);
int32_t brill;
MTOFEXTENDED(param_brill + inlet_brill, brill);
brill >>= 4;
gain = ___SMMUL(gain, brill);
if (gain < (1 << 15))
  gain = 1 << 15;
int32_t dissym = param_dissym + inlet_dissym;
if (dissym < -(1 << 27))
  dissym = -(1 << 27);
else if (dissym > (5 << 25))
  dissym = 5 << 25;
int32_t offset = (1 << 27) + 685 * (dissym >> 11);
Audio Rate
p += dp;
int32_t t;
if (p <= 0x7FFFFFFFUL) // 0 1<<31
  t = p >> 3;          // 0 +1<<28
else
  t = (0xFFFFFFFFUL - p) >> 3;

t = ___SMMUL(t - offset, gain);
t = __SSAT(t, 11); //-1024 1023

outlet_wave = sine2t[t & 4095] >> 4;

Privacy

© 2024 Zrna Research