wf_12Chorus

Author: Smashed Transistors
License: LGPL
Github: tiar/osc/wf12/wf_12Chorus.axo

Inlets

frac32.bipolar rateA

frac32.bipolar rateB

frac32.positive depthA

frac32.positive depthB

frac32buffer.bipolar wf 12

Outlets

frac32buffer.bipolar wf 12

Parameters

frac32.u.map depthA

frac32.u.map depthB

frac32.s.map.lfopitch rateA

frac32.s.map.lfopitch rateB

Declaration
uint32_t p[12];
const float a[12] = {4.023f / 11.0f, 10.33f / 11.0f, 0.01f / 11.0f,
                     3.297f / 11.0f, 9.037f / 11.0f, 7.831f / 11.0f,
                     0.231f / 11.0f, 2.174f / 11.0f, 1.317f / 11.0f,
                     11 / 11.0f,     4.742f / 11.0f, 7.431f / 11.0f};
Init
// pseudo random init of phases
p[0] = 12346545;
for (int i = 1; i < 12; i++)
  p[i] = 69069 * p[i - 1];
Control Rate
int32_t dp, dp1, ddp;
MTOFEXTENDED(param_rateA + inlet_rateA, dp);
MTOFEXTENDED(param_rateB + inlet_rateB, dp1);

dp >>= 2;
ddp = (dp1 >> 2) - dp;

int32_t depthA = param_depthA + inlet_depthA;
int32_t ddepth = param_depthB + inlet_depthB - depthA;
for (int i = 0; i < 12; i++) {
  int depth = (int32_t)(depthA + a[i] * ddepth);
  p[i] += (int32_t)(dp + a[i] * ddp);
  //                                           -1.0 1.0 q27
  //                                       <-> -0.5 0.5 q28    q31
  //                                                 |          |(q28,q31) ->
  //                                                 q27
  //                         q27                     |          |              |
  outlet_wf12[i] =
      ___SMMUL(inlet_wf12[i], ___SMMLA(depth, sine2t[p[i] >> 20], 1 << 27))
      << 5;
  //    out      =           in         *  (       depth*   sin (   p    )+    1
  //    );
}

Privacy

© 2024 Zrna Research