pllOSC

PLL oscillator. Feed another audio signal into the "MOD" inlet and turn up the PLL to force the oscillator into tracking the incoming signal. FM and PM controls modulation of the oscillator by the MOD input.
Author: Remco van der Most
License: BSD
Github: sss/osc/pllOSC.axo

Inlets

frac32.bipolar pitch

frac32buffer phase

frac32 FM

frac32 PM

frac32 PLL

bool32 active

Outlets

frac32buffer.bipolar sine wave

Parameters

frac32.s.map.pitch pitch

frac32.s.map.pitch LP

frac32.s.map FM

frac32.s.map PM

frac32.u.map PLL

Declaration
uint32_t Phase1;
uint32_t Phase2;
int32_t min1;
int32_t min2;
int32_t min3;
int32_t val;
int32_t wave;
int32_t freq;
int32_t f;
Init
Phase1 = 0;
Phase2 = 0;
val = 0;
Control Rate
if (inlet_active > 0) {
  MTOFEXTENDED(param_pitch + inlet_pitch, freq);
  MTOF(param_LP, f);
}
Audio Rate
if (inlet_active > 0) {
  Phase1 += freq + val;
  int32_t r1;
  int32_t p2 = Phase1;
  SINE2TINTERP(p2, r1)
  min3 = ((r1 >> 4) > (min2)) ? -1 : 1;
  wave = (r1 >> 4);
  min1 = ___SMMUL((wave - inlet_MOD) << 3, (inlet_PLL + param_PLL) * min3 << 2);
  val = ___SMMLA((min1 - val) << 1, f, val);
  min2 = wave;
  int32_t FM = ___SMMUL((inlet_FM + param_FM) << 3, inlet_MOD << 2);
  Phase2 += freq + val + ___SMMUL(FM << 1, (freq + val) << 5);
  int32_t r2;
  SINE2TINTERP(
      Phase2 + ___SMMUL(inlet_MOD << 3, (inlet_PM + param_PM) << 2) << 4, r2)
  outlet_wave = r2 >> 4;
}

Privacy

© 2024 Zrna Research