SyncPM4

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

Inlets

frac32.bipolar pitch

frac32.bipolar pitchC

frac32.bipolar pitchM1

frac32.bipolar pitchM2

frac32.bipolar pitchM3

frac32.bipolar index1C

frac32.bipolar index21

frac32.bipolar index32

frac32.bipolar phiC

frac32.bipolar phiM1

Outlets

frac32buffer.bipolar out

Parameters

frac32.s.map.pitch pitch

frac32.s.map.pitch pitchC

frac32.s.map.pitch pitchM1

frac32.s.map.pitch pitchM2

frac32.s.map.pitch pitchM3

frac32.u.map index1C

frac32.u.map index21

frac32.u.map index32

Attributes

combo phase

combo env

Declaration
uint32_t pC, pM1, pM2, pM3;
int32_t dpC, dpM1, dpM2, dpM3;
int32_t index1C, index21, index32;
float pMast;
float dpMast, _dpMast;
Init
uint32_t pC = pM1 = pM2 = pM3 = 0;
pMast = attr_phase;
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_pitchM3 + param_pitchM3, dpM3);
MTOFEXTENDED(inlet_pitchM2 + param_pitchM2, dpM2);
MTOFEXTENDED(inlet_pitchM1 + param_pitchM1, dpM1);
index1C = inlet_index1C + param_index1C;
index21 = inlet_index21 + param_index21;
index32 = inlet_index32 + param_index32;
Audio Rate
pM2 += dpM2;
pM3 += dpM3;
int32_t m23 = (___SMMLA(index32, sine2t[pM3 >> 20], pM2 >> 7) >> 13) & 4095;
pM1 += dpM1;
int32_t m12 = (___SMMLA(index21, sine2t[m23], pM1 >> 7) >> 13) & 4095;
pC += dpC;
int32_t y = sine2t[(___SMMLA(index1C, sine2t[m12], pC >> 7) >> 13) & 4095] >> 5;

#if attr_env == 1
if (pMast > 0.9f) {
  y = (int32_t)(y * 10 * (1 - pMast));
}
if (pMast < 0.1f) {
  y = (int32_t)(y * 10 * pMast);
}

#else
y = (int32_t)(y * 2 * (pMast > 0.5f ? 1 - pMast : pMast));
#endif

// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

pMast += dpMast;
if (pMast > 1) {
  pMast -= 1;
  float a = pMast * _dpMast;
  pC = (uint32_t)(a * dpC) + (inlet_phiC << 5);
  pM1 = (uint32_t)(a * dpM1) + (inlet_phiM1 << 5);
  pM2 = (uint32_t)(a * dpM2);
  pM3 = (uint32_t)(a * dpM3);
  /*  y = (y + (sine2t[(___SMMLA(index, sine2t[pM >> 20], pC >> 7) >> 13) &
   * 4095] >> 5)) >> 1;*/
}
outlet_out = y;

Privacy

© 2024 Zrna Research