SelfPMSync

Advanced version with built-in Master oscillator. See help patch for usage !!
Author: Smashed Transistors
License: LGPL
Github: tiar/osc/SelfPMSync.axo

Inlets

frac32.bipolar pitch_slave

frac32.bipolar pitch master

frac32.positive beta

Outlets

frac32buffer.bipolar out

Parameters

frac32.s.map.pitch pitch slave

frac32.s.map.pitch pitch master

frac32.s.map beta

frac32.s.map octaviate

Declaration
int32_t a_y, b_y;
uint32_t a_p, b_p;
uint32_t dp, dpM, _dpM, pM;
int32_t beta;
Init
a_y = b_y = a_p = b_p = pM = 0;
Control Rate
MTOFEXTENDED(param_pitch_space_master + inlet_pitch_space_master, dpM);
float f_dpM = 4294967296.0f / dpM;
MTOFEXTENDED(param_pitch_space_slave + inlet_pitch_space_slave, dp);
beta = inlet_beta + param_beta;
beta = 51 * (beta >> 6);
_dpM = (uint32_t)f_dpM;
Audio Rate
pM += dpM;
if (pM < dpM)
  a_p = ___SMMUL(dp, ___SMMUL(pM >> 1, _dpM)) << 1;
else
  a_p += dp;

a_y = (sine2t[(((a_p >> 7) + ___SMMUL(a_y, beta)) >> 13) & 4095] >> 3) +
      (a_y >> 1); // q29

uint32_t b_pM = pM + 0x80000000U;
if (b_pM < dpM)
  b_p = ___SMMUL(dp, ___SMMUL(b_pM >> 1, _dpM)) << 1;
else
  b_p += dp;

b_y = (sine2t[(((b_p >> 7) + ___SMMUL(b_y, beta)) >> 13) & 4095] >> 3) +
      (b_y >> 1);
int32_t b_out = ___SMMUL(b_y, param_octaviate) << 5;

int32_t e = (sine2t[(pM + (3U << 30)) >> 20] >> 2) + (1 << 29); // [0 1] q 30
outlet_out = ___SMMLA(e, a_y - b_out, b_out >> 2);

Privacy

© 2024 Zrna Research