frac32.bipolar pitch
frac32.bipolar randomness
frac32buffer.bipolar out
frac32.s.map pitch
frac32.s.map randomness
uint32_t p; // phase counter
int32_t dp; // delta phase
int32_t r; // sign and delta phase random gen
int32_t r2; // color rand gen
int32_t nextR2; // color slide
int32_t env; // decay exp env
uint8_t c;
p = 0;
dp = 1 << 30;
r = 137;
r2 = 137;
nextR2 = 137;
env = 1 << 27;
c = 0;
int32_t basePitch = param_pitch + inlet_pitch;
int32_t mod = param_randomness + inlet_randomness; // pitch rand mod depth
c++;
if (c >= 100) {
c = 0;
nextR2 = -1511872763 * (nextR2 - 1);
}
p += dp;
if (p < dp) { // p have just wrapped to zero
// reset env with random sign
env = (r = r * 69069 + 1) > 0 ? 1 << 28 : -1 << 28;
// pitch with random modulation
int32_t pitch = ___SMMLA(r = r * 69069 + 1, mod, basePitch);
// delta phase
MTOFEXTENDED(pitch, dp);
//"color" slide
r2 = nextR2;
}
outlet_out = ___SMMUL(r2, env);
// color pseudo rand seq
r2 = r2 * 69069 + 1;
// color env
env = ___SMMUL(env, 127 << 24) << 1;