disharm

Author: Smashed Transistors
License: LGPL
Github: tiar/PIW/disharm.axo

Inlets

None

Outlets

None

Attributes

objref piwt

spinner hA

spinner hB

spinner hC

spinner hD

spinner hE

spinner hF

spinner hG

spinner hH

Init
for (int i = 0; i < attr_piwt.LENGTH; i++) {
  attr_piwt.fv[i] = arm::q_to_float(attr_piwt.v[i], 27 - attr_piwt.GAIN);
}

int8_t h[8] = {attr_hA, attr_hB, attr_hC, attr_hD,
               attr_hE, attr_hF, attr_hG, attr_hH};

for (int harmo = 0; harmo < 8; harmo++) {
  if (h[harmo] == 0)
    continue;
  float s = 0;
  float c = 0;
  float p = 0;
  float dp = h[harmo] * (1.0f / attr_piwt.LENGTH);
  for (int i = 0; i < attr_piwt.LENGTH; i++) {
    c += attr_piwt.fv[i] * attr_piwt.sin1(p + 0.25f);
    s += attr_piwt.fv[i] * attr_piwt.sin1(p);
    p += dp;
  }
  c *= 2.0f / attr_piwt.LENGTH;
  s *= 2.0f / attr_piwt.LENGTH;
  p = 0;
  for (int i = 0; i < attr_piwt.LENGTH; i++) {
    attr_piwt.fv[i] -= c * attr_piwt.sin1(p + 0.25f) + s * attr_piwt.sin1(p);
    p += dp;
  }
}
attr_piwt.prepare();

Privacy

© 2024 Zrna Research