int32.positive Use with Phi-delay-"write_pow_out" module to set used samplelength set in the delay_write module
frac32.bipolar Shift by semitone
frac32.bipolar Shift by harmonic. ratio is 4:1 (1 harmonic per knob value 4)
frac32.bipolar Shift by ratio. ratio is 8:1 (1 harmonic per knob value 8)
frac32.positive set window to rate ratio to reduce/induce tremelo.
frac32buffer AudioOut
frac32 result
objref delayname
int32_t _prev1;
int32_t _step1;
int32_t _prev2;
int32_t _step2;
uint32_t Phase;
uint32_t r;
uint32_t h;
int32_t val;
int32_t freq;
int32_t freh;
Phase = 0;
r = 1;
val = 0;
int32_t f;
int32_t sami = inlet_semitone > 0 ? 0 : inlet_semitone;
MTOF((1 << 27) + sami, f);
int64_t ratio;
int32_t windowratio = ((inlet_windowratio - (1 << 26)) * 10 / 11) + (1 << 26);
int32_t invwindowratio = (1 << 27) - windowratio;
int32_t ratioshift;
if (inlet_ratioshift) {
ratioshift = inlet_ratioshift;
} else {
ratioshift = (1 << 24);
}
int32_t result;
int32_t ar = inlet_semitone * 8 / 12;
int8_t s = (ar >> 24) + 4;
uint8_t ei = ar >> 16;
if (s >= 0)
result = ((expt[ei] << s) << 2) - (1 << 21);
else
result = ((expt[ei] >> (-s))) - (1 << 21);
outlet_result = result;
int32_t frac;
int32_t depth;
depth = ___SMMUL((1 << 25) << 3, invwindowratio << 2) << 2;
if ((inlet_samplelength - 13) >= 0)
frac = (___SMMUL(((1 << 25) + (1 << 21) / 20) << 3, windowratio << 2) << 2) >>
(inlet_samplelength - 13);
else
frac = (___SMMUL(((1 << 25) + (1 << 21) / 20) << 3, windowratio << 2) << 2)
<< (inlet_samplelength - 13);
freq = frac;
freh = ___SMMUL(freq << 3, inlet_harmshift) << 6;
freq = ___SMMUL(result << 3, freq << 2) << 4;
int32_t wave;
int32_t fras = (-(freq + freh) >> 2);
int32_t ratoo = ___SMMUL((ratioshift - (1 << 24)) << 1, (fras + frac) << 2)
<< 1;
Phase += (fras - ratoo);
wave = (Phase >> 5);
int32_t Sin;
SINE2TINTERP(Phase - (1 << 29), Sin)
int32_t sina = -(Sin >> 5) + (1 << 26);
int32_t saw;
saw = ((Phase >> 5) + (1 << 24)) & ((1 << 27) - 1);
int32_t saw2;
saw2 = (saw + (1 << 26)) & ((1 << 27) - 1);
int32_t timea;
int32_t timeb;
timea = ___SMMUL(saw << 3, depth);
timeb = ___SMMUL(saw2 << 3, depth);
_step1 = (timea - _prev1) >> 4;
int32_t _i1 = _prev1;
_prev1 = timea;
_step2 = (timeb - _prev2) >> 4;
int32_t _i2 = _prev2;
_prev2 = timeb;
int32_t ccompl = ((128 << 20) - sina);
int32_t conv1;
int32_t conv2;
conv1 = _i1;
_i1 += _step1;
conv2 = _i2;
_i2 += _step2;
int32_t pitch1;
int32_t pitch2;
uint32_t delay1 = attr_delayname.writepos -
(__USAT(conv1, 27) >> (27 - attr_delayname.LENGTHPOW)) -
BUFSIZE + buffer_index;
pitch1 = attr_delayname.array[delay1 & attr_delayname.LENGTHMASK] << 14;
uint32_t delay2 = attr_delayname.writepos -
(__USAT(conv2, 27) >> (27 - attr_delayname.LENGTHPOW)) -
BUFSIZE + buffer_index;
pitch2 = attr_delayname.array[delay2 & attr_delayname.LENGTHMASK] << 14;
{
int64_t a = (int64_t)pitch2 * sina;
a += (int64_t)pitch1 * ccompl;
outlet_AudioOut = a >> 27;
}