APC4

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

Inlets

frac32buffer in

frac32 freq1

frac32 freq2

frac32 freq3

frac32 freq4

frac32 fb

Outlets

frac32buffer out

Declaration
class APC {
public:
  int32_t v[4];
  int32_t g[4];
  void init(void) {
    for (int i = 0; i < 4; i++)
      v[i] = 0;
  }
  int32_t aProc(int32_t x) {
    int32_t y = x;
    for (int p = 0; p < 4; p++) {
      int32_t u = ___SMMLA(g[p], v[p] << 1, y);
      y = ___SMMLS(g[p], u << 1, v[p]);
      v[p] = u;
    }
    return y;
  }
};
APC apc;
int32_t v;
Init
apc.init();
v = 0;
Control Rate
apc.g[0] = 0x7FFFFFFF - (__USAT(inlet_freq1, 27) << 4);
apc.g[1] = 0x7FFFFFFF - (__USAT(inlet_freq2, 27) << 4);
apc.g[2] = 0x7FFFFFFF - (__USAT(inlet_freq3, 27) << 4);
apc.g[3] = 0x7FFFFFFF - (__USAT(inlet_freq4, 27) << 4);
int32_t fb = __USAT((inlet_fb), 27) << 4; // q31
Audio Rate
// nested all pass chain
int32_t u = ___SMMLA(fb, v << 1, inlet_in);
outlet_out = ___SMMLS(fb, u << 1, v);
v = apc.aProc(u >> 8) << 8;

Privacy

© 2024 Zrna Research