EvOsc

Author: Smashed Transistors
License: LGPL
Github: tiar/dev/EvOsc.axo

Inlets

frac32.bipolar pitch

bool32.rising Rand

Outlets

frac32buffer.bipolar selfPM wave

Parameters

frac32.s.map.pitch pitch

Declaration
float t[256];
float c0 = 1, c1 = 0;
int32_t rnd = 137;
float p = 0, dp = 1, _dp = 1;
bool aRand = false;
uint8_t c = 0;
uint8_t nextU8() { return (uint8_t)((rnd = rnd * 69069 + 1) >> 24); }
float nextF() { return arm::q_to_float(rnd = rnd * 69069 + 1, 31); }
Control Rate
int32_t idp;
MTOFEXTENDED(param_pitch + inlet_pitch, idp);
dp = idp * (0.25f / (1 << 30));
_dp = 1 / dp;
// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
// trig de rand
if (!aRand && inlet_Rand) {
  for (int i = 0; i < 256; i++) {
    t[i] += 0.33f * (nextF() - t[i]);
  }
}
aRand = inlet_Rand;

// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
// rotation 10°
{
  uint8_t p = nextU8();
  uint8_t p2 = p + 37;
  float ntp2 = 0.9848f * t[p2] + 0.1736f * t[p];
  t[p] = 0.9848f * t[p] - 0.1736f * t[p2];
  t[p2] = ntp2;
}

// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
// decay
t[nextU8()] *= 0.9f;
// t[nextU8()] *= 1.0f - arm::q_to_float(param_decay,28);
// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
// LP
for (int i = 0; i < 2; i++) {
  uint8_t p = nextU8();
  t[p] = 0.8f * t[p] + 0.1f * (t[(uint8_t)(p - 1)] + t[(uint8_t)(p + 1)]);
}
Audio Rate
p += dp;
if (p > 1) {
  p -= 1;
  c1 = p * _dp;
  c0 = 1 - c1;
  c = 0;
}
float acc = c0 * t[c];
c++;
acc += c1 * t[c];
float e = p * 2;
if (e > 1)
  e = 2 - e;
e = 3 * e * e - 2 * e * e * e;
acc *= e;
outlet_out = arm::float_to_q(acc, 27);

Privacy

© 2024 Zrna Research