APChain

Author: Smashed Transistors
License: LGPL
Github: tiar/filter/APChain.axo

Inlets

frac32buffer filter input

frac32 pitch

frac32 filter resonance

Outlets

frac32buffer filter output

Parameters

frac32.u.map freq

frac32.s.map.ratio g2

Attributes

combo order

Declaration
class APC {
public:
  int32_t v[attr_order];
  void init(void) {
    for (int i = 0; i < attr_order; i++)
      v[i] = 0;
  }
  int32_t aProc(int32_t x, int32_t g) {
    int32_t y = x;
    for (int p = 0; p < attr_order; p++) {
      int32_t u = ___SMMLA(g, v[p] << 1, y);
      y = ___SMMLS(g, u << 1, v[p]);
      v[p] = u;
    }
    return y;
  }
};
APC apc;
int32_t v;
Init
apc.init();
v = 0;
Control Rate
int32_t g = 0x7FFFFFFF - (__USAT((param_freq + inlet_freq), 27) << 4);
int32_t g2 = __USAT((param_g2 + inlet_g2), 27) << 4; // q31
Audio Rate
// nested all pass chain
int32_t u = ___SMMLA(g2, v << 1, inlet_in);
outlet_out = ___SMMLS(g2, u << 1, v);
v = apc.aProc(u >> 8, g) << 8;

Privacy

© 2024 Zrna Research