distmix3

3 channel 2 stage distorting mixer. The volume of each input is controlled at the first stage adding individual distortion based on the strength of the respective input plus the (mix)value of the second stage. The second stage then sums the three channels and applies it's own distortion when the signal becomes hot. For a very aggressive distortion, add a second module and connect the output of the first to all three inputs of the second. When applying a loud basskick at one of the inputs and a less loud bass, the mixer will tend to duck the bass,
Author: Remco van der Most
License: BSD
Github: sss/mix/distmix3.axo

Inlets

frac32buffer in1

frac32buffer in2

frac32buffer in3

Outlets

frac32buffer out

Parameters

bool32.tgl GAIN

frac32.u.map.gain16 gain1

frac32.u.map.gain16 gain2

frac32.u.map.gain16 gain3

frac32.u.map.gain symmetry

frac32.u.map.gain overall

Declaration
int32_t val[4];

int32_t v27 = 1 << 27;
int32_t v30 = 1 << 30;
int32_t hp[4];
int32_t symmetry;

int32_t clamp(int32_t in, int I) {
  hp[I] += val[I] - hp[I] >> 10;
  val[I] -= hp[I];
  int32_t damp;
  int32_t ABS = __SSAT(val[I] + val[3] >> 1, 28);
  ABS = ___SMMUL(ABS, ABS) << 5;
  ABS = ___SMMUL(ABS, ABS) << 5;
  ABS = ___SMMUL(ABS, ABS) << 5;
  MTOF(v27 - (ABS << 2) -
           (val[I] < 0 ? ___SMMUL(__USAT(ABS, 24), symmetry) << 6 : 0) *
               (I > 2 ? -1 : 1),
       damp)
  damp = (val[I] > 0 ? val[I] : -val[I]) > (in > 0 ? in : -in)
             ? (uint32_t)v30 + damp >> 1
             : damp;
  val[I] += ___SMMUL((in - val[I]), damp) << 1;
}
Control Rate
symmetry = param_symmetry;
Audio Rate
clamp(__SSAT(___SMMUL(__SSAT(inlet_in1, 28) << 1, param_gain1), 28), 0);
clamp(__SSAT(___SMMUL(__SSAT(inlet_in2, 28) << 1, param_gain2), 28), 1);
clamp(__SSAT(___SMMUL(__SSAT(inlet_in3, 28) << 1, param_gain3), 28), 2);
clamp(__SSAT(___SMMUL(__SSAT(val[0] + val[1] + val[2], 28) << 1, param_overall),
             28),
      3);
outlet_out = val[3] >> 1 - param_GAIN;

Privacy

© 2024 Zrna Research