SHmix

Mixing S&H modulator internal phase-oscillator holds the last value on the "in" input when returning to the start of the phase. While phase goes up, it mixes in the incoming signal. PW controls the point where the mix-in starts.
Author: Remco van der Most
License: BSD
Github: sss/dist/SHmix.axo

Inlets

frac32 pitch

frac32 freq

frac32buffer phase increment

Outlets

frac32buffer.positive phasor wave

frac32buffer p

Parameters

frac32.u.map.squaregain morph

frac32.u.map pw

frac32.s.map octave

Declaration
uint32_t Phase;
int32_t SQR;
int32_t val;
uint32_t prv;
Init
Phase = 0;
Control Rate
uint32_t freq;
MTOFEXTENDED(((param_octave >> 24) * 12 << 21) + inlet_pitch, freq);
uint32_t F;
F = ___SMMUL(param_morph, param_morph) >> 9;
freq += inlet_freq + F;
float32_t ratio;
int32_t pw = param_pw;
ratio = (float32_t)(1 << 27) / ((1 << 27) - pw) * 32;
Audio Rate
Phase += freq;

uint32_t p2 = Phase >> 5;
p2 = p2 > pw ? p2 - pw : 0;
p2 = p2 * ratio;

if (Phase < prv) {
  SQR = inlet_in;
}
int32_t phasor = SQR + ___SMMUL(inlet_in - SQR << 1, p2 >> 1);
val += (phasor - val) >> 9;
outlet_wave = phasor - val;
prv = Phase;
outlet_p = p2 >> 4;

Privacy

© 2024 Zrna Research