KWSync.axo

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

Inlets

frac32.bipolar pitch_slave

frac32.bipolar pitch master

Outlets

frac32buffer.bipolar out

Parameters

frac32.s.map.pitch pitch slave

frac32.s.map.pitch pitch master

Declaration
// dissym picky sqr
float F(float p) {
  float x = p + 16;
  x = (x - ((int)x) - 0.5f); //  x[-0.5, 0.5]
  float x2 = x * x;
  if (x > 0) {
    if (x < 0.25f)
      return x2 * (3 - 8 * x2);
    else
      return 0.3125f - 0.625f * x;
  } else {
    if (x > -0.25f)
      return x2 * (-3 + 8 * x2);
    else
      return -0.3125f - 0.625f * x;
  }
}

float pM, pS, dpM, _dpM, dpS, _dpS, f, FpS;
Init
pM = 0;
pS = 0;
FpS = 0;
Control Rate
int32_t idp;
MTOFEXTENDED(param_pitch_space_slave + inlet_pitch_space_slave, idp);
dpS = (idp * (0.25f / (1 << 30)));
_dpS = 1.0f / dpS;

// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
MTOFEXTENDED(param_pitch_space_master + inlet_pitch_space_master, idp);
dpM = (idp * (0.25f / (1 << 30)));
_dpM = 1 / dpM;
Audio Rate
pM += dpM;
if (pM > 1) {
  pM -= 1;
  float a = pM * _dpM;

  f = F(pS + (1 - a) * dpS) - FpS;
  pS = a * dpS;
  FpS = F(pS);
  f += FpS - F(0);
  f *= _dpS;
} else {
  f = FpS;
  pS += dpS;
  if (pS > 1)
    pS -= 1;
  FpS = F(pS);
  f = (FpS - f) * _dpS;
}
outlet_out = (int32_t)((1 << 27) * f);

Privacy

© 2024 Zrna Research