sinePeak

adds a "sined peak" to the phase (incoming signal). Peak is a triangle converted by an exponential curve (stackable for tighter peak) and then goes through a sine-shaper to round of the peak. offset: controls the position of the peak strength: controls the tightness of the peak (the higher, the thinner) level: controls the hight of the peak.
Author: Remco van der Most
License: BSD
Github: sss/shape/sinePeak.axo

Inlets

frac32 offset

frac32 strength

frac32 level

frac32buffer in

Outlets

frac32buffer out

Parameters

frac32.s.map offset

frac32.s.map level

frac32.u.map strength

int32 stack

Declaration
int i;
int32_t pEXP;
int32_t sEXP;
int32_t pMOD;
int32_t sMOD;
int32_t sOFS;
int32_t pOFS;
Control Rate
int32_t EXP = param_strength + inlet_strength;
int32_t MOD = param_level + inlet_level;
int32_t OFS = param_offset + inlet_offset;

sEXP = (EXP - pEXP) >> 4;
int32_t S1 = pEXP;
pEXP = EXP;

sMOD = (MOD - pMOD) >> 4;
int32_t S2 = pMOD;
pMOD = MOD;

sOFS = (OFS - pOFS) >> 4;
int32_t S3 = pOFS;
pOFS = OFS;
Audio Rate
S1 += sEXP;
S2 += sMOD;
S3 += sOFS;

int32_t pos = (inlet_in - S3) & ((1 << 27) - 1);
pos = pos > (1 << 26) ? (1 << 27) - pos : pos;
pos = pos << 1;
int32_t tmp = pos;
int32_t strength = (1 << 27) - S1 + ___SMMUL(pos << 3, S1 << 2);
for (i = 0; i < param_stack; i++) {
  pos = ___SMMUL(pos << 3, strength << 2);
}

int32_t sine;
SINE2TINTERP((pos << 4) - (1 << 30), sine)
pos = (sine >> 5) + (1 << 26);
outlet_out = inlet_in + ___SMMUL(S2 << 3, pos << 2);

Privacy

© 2024 Zrna Research