3xModOsc

3-core oscillator with serial FM,PM and AM
Author: Remco van der Most
License: BSD
Github: sss/osc/3xModOsc.axo

Inlets

frac32 pitch

frac32 FM

frac32 PM

frac32 AM

bool32 active

Outlets

frac32buffer.positive phasor wave

Parameters

frac32.s.map.pitch pitch1

frac32.s.map Hrm1

frac32.s.map Hrm2

frac32.s.map Hrm3

frac32.s.map lfo

Declaration
uint32_t Phase1;
uint32_t Phase2;
uint32_t Phase3;
int32_t a;
int32_t b;
int32_t c;
int32_t ring1;
int32_t ring2;
int32_t ring3;
int32_t ring4;
int32_t MOD1;
int32_t MOD2;
int32_t MOD3;

uint32_t phase;

uint32_t lfo;
int32_t freq;
Init
Phase1 = 0;
Phase2 = 0;
Phase3 = 0;

phase = 0;
Control Rate
if (inlet_active > 0) {
  MTOFEXTENDED(inlet_pitch + param_lfo, freq);
  lfo += freq >> 2;
}
Audio Rate
if (inlet_active > 0) {
  uint32_t f;
  MTOFEXTENDED(param_pitch1 + inlet_pitch, f);
  f = f * (param_Hrm1 >> 20);
  MOD1 = ___SMMUL(inlet_FM, c << 3);
  Phase1 += (f) + (___SMMUL(f << 3, MOD1 << 3) << 1);

  SINE2TINTERP((Phase1 << 1) + ___SMMUL(inlet_AM << 3, (-ring4 << 11)), a)

  uint32_t g;
  MTOFEXTENDED(param_pitch1 + inlet_pitch, g);
  g = g * (param_Hrm2 >> 20);
  MOD2 = ___SMMUL(inlet_FM, -a << 3);
  Phase2 += (g) + (___SMMUL(g << 3, MOD2 << 3) << 1);

  SINE2TINTERP((Phase2 << 1) + (___SMMUL(inlet_PM << 4, a) << 3) + lfo, b)

  uint32_t h;
  MTOFEXTENDED(param_pitch1 + inlet_pitch, h);
  h = h * (param_Hrm3 >> 20);
  MOD3 = ___SMMUL(inlet_FM, -b << 3);
  Phase3 += (h) + (___SMMUL(h << 3, MOD3 << 3) << 1);

  SINE2TINTERP((Phase3 << 1) + (___SMMUL(inlet_PM << 4, b) << 3) - (lfo << 1) +
                   (1 << 26),
               c)

  ring1 = ___SMMUL(a >> 2, b >> 3) >> 3;
  ring2 = ___SMMUL(b >> 2, c >> 3) >> 3;
  ring3 = ___SMMUL(a >> 2, c >> 3) >> 3;
  ring4 = ___SMMUL(ring1, c >> 3) >> 3;

  outlet_phasor = (a >> 6) + (b >> 6) + (c >> 6) +
                  ___SMMUL(inlet_AM << 3, (ring1 + ring2 + ring3 + ring4) << 4);
}

Privacy

© 2024 Zrna Research