analogue

analogue style distortion, with "capacitor" holding the available charge
Author: Remco van der Most
License: BSD
Github: sss/dist/analogue.axo

Inlets

frac32buffer Audio

frac32 Gain

frac32 Feed

frac32 Power

frac32 Pitch

int32.positive Mode

Outlets

frac32buffer output

Parameters

frac32.u.map risetime

frac32.u.map falltime

frac32.u.map LPHP

frac32.s.map Freq

Declaration
int32_t acc;
int32_t gain;
int32_t input;
int32_t take;
int32_t tak2;
int32_t tak3;
int32_t tak4;
int32_t val1;
int32_t val2;
int32_t val3;
int32_t val4;
int32_t val5;
int32_t audio;
Init
acc = 0;

gain = 0;
input = 0;
take = 0;
tak2 = 0;
tak3 = 0;
tak4 = 0;

val1 = 0;
val2 = 0;
val3 = 0;
val4 = 0;
val5 = 0;
Control Rate
int32_t f;
MTOF(param_Freq + inlet_Pitch, f);
Audio Rate
int32_t rise = (param_risetime / 48 * 47) << 4;
int32_t fall = (___SMMUL(rise >> 1, param_falltime << 2)) << 4;

tak2 = tak2 >= 0 ? tak2 : -tak2;

if ((inlet_Mode == 1) || (inlet_Mode == 5)) {
  take = ___SMMUL((inlet_Audio + tak3) << 3, gain << 4);
} else {
  take = tak2;
}
take = take >= 0 ? take : -take;

if (inlet_Mode == 0) {
  if (take > val2) {
    val2 = ___SMMLA(val2 - take, (-1 << 31) + (fall), val2);
  } else {
    val2 = ___SMMLA(val2 - take, (-1 << 31) + (rise), val2);
  }
  take = val2;
}

acc += inlet_Power - (take);
acc = __SSAT(acc, 28);
acc = acc <= 0 ? 0 : acc;
if (inlet_Mode > 0) {
  if (acc > val1) {
    val1 = ___SMMLA(val1 - acc, (-1 << 31) + (rise), val1);
  } else {
    val1 = ___SMMLA(val1 - acc, (-1 << 31) + (fall), val1);
  }
  acc = val1;
}

gain = acc > (inlet_Gain << 3) ? (inlet_Gain << 3) : acc;

if ((inlet_Mode == 2) || (inlet_Mode == 5)) {
  if (gain > val3) {
    val3 = ___SMMLA(val3 - gain, (-1 << 31) + (rise), val3);
  } else {
    val3 = ___SMMLA(val3 - gain, (-1 << 31) + (fall), val3);
  }
  gain = val3;
}

audio = inlet_Audio + tak3;

if ((inlet_Mode == 4) || (inlet_Mode == 5)) {
  if (audio > val4) {
    val4 = ___SMMLA(val4 - audio, (-1 << 31) + (rise), val4);
  } else {
    val4 = ___SMMLA(val4 - audio, (-1 << 31) + (fall), val4);
  }
  audio = val4;
}

tak2 = __SSAT(___SMMUL(audio << 3, gain << 4), 28);
tak4 = ___SMMUL(tak2 << 2, inlet_Feed << 2);

val5 = ___SMMLA((tak4 - val5) << 1, f, val5);
tak3 = tak4 - (___SMMUL(val5 << 3, param_LPHP << 2));
outlet_out = tak2;

Privacy

© 2024 Zrna Research