SyncPM2

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

Inlets

frac32.bipolar pitch

frac32.bipolar pitchC

frac32.bipolar pitchM

frac32.bipolar index

Outlets

frac32buffer.bipolar out

Parameters

frac32.s.map.pitch pitch

frac32.s.map.pitch pitchC

frac32.s.map.pitch pitchM

frac32.u.map index

Declaration
uint32_t pC;
uint32_t pM;
int32_t dpC, dpM;
int32_t index;
float pMast;
float dpMast, _dpMast;
Init
pC = 0;
pM = 0;
pMast = 0;
Control Rate
int32_t idp;
MTOFEXTENDED(inlet_pitch + param_pitch, idp);
dpMast = (0.25f / (1 << 30)) * idp;
_dpMast = 1.0f / dpMast;

MTOFEXTENDED(inlet_pitchC + param_pitchC, dpC);
MTOFEXTENDED(inlet_pitchM + param_pitchM, dpM);
index = inlet_index + param_index;
Audio Rate
pC += dpC;
pM += dpM;
int32_t y =
    sine2t[(___SMMLA(index, sine2t[pM >> 20], pC >> 7) >> 13) & 4095] >> 5;
if (pMast > 0.9f) {
  y = (int32_t)(y * 10 * (1 - pMast));
}
if (pMast < 0.1f) {
  y = (int32_t)(y * 10 * pMast);
}
// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

pMast += dpMast;
if (pMast > 1) {
  pMast -= 1;
  float a = pMast * _dpMast;
  pC = (uint32_t)(a * dpC);
  pM = (uint32_t)(a * dpM);
  /*  y = (y + (sine2t[(___SMMLA(index, sine2t[pM >> 20], pC >> 7) >> 13) &
   * 4095] >> 5)) >> 1;*/
}
outlet_out = y;

Privacy

© 2024 Zrna Research