crusher

heavy crushing distortion module -"min/max" clip incoming audio at set min/max levels. -"bias" DC-offsets the audio input -"diffmax" sets maximum difference level between original and clipped audio (for clipper-overshoot) -"LP/HP" set cutoff frequencies for the clipper-overshoot -"feedback" feeds back the audio output to the audio input of the distortion.
Author: Remco van der Most
License: BSD
Github: sss/dist/crusher.axo

Inlets

frac32buffer in

frac32.bipolar max

frac32.bipolar bias

frac32.bipolar min

frac32.bipolar diffmax

frac32.bipolar LP

frac32.bipolar HP

frac32 feed

Outlets

frac32buffer out

Parameters

frac32.s.map max

frac32.s.map bias

frac32.s.map min

frac32.u.map diffmax

frac32.u.map feedback

frac32.s.map.pitch LP

frac32.s.map.pitch HP

Declaration
int32_t val1;
int32_t val2;
int32_t val3;
int32_t temp;

int32_t prevMax;
int32_t prevBias;
int32_t prevMin;
int32_t prevDiffmax;
int32_t prevF;
int32_t prevG;
int32_t prevfb;
int32_t stepMax;
int32_t stepBias;
int32_t stepMin;
int32_t stepDiffmax;
int32_t stepF;
int32_t stepG;
int32_t stepfb;
Control Rate
if (param_max < param_min) {
  PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_min], param_max,
                     0xFFFD);
  PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_max], param_min,
                     0xFFFD);
}
if (param_LP < param_HP) {
  PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_HP], param_LP,
                     0xFFFD);
  PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_LP], param_HP,
                     0xFFFD);
}

int32_t Max = param_max + inlet_max;
int32_t Bias = param_bias + inlet_bias;
int32_t Min = param_min + inlet_min;
int32_t Diffmax = param_diffmax + inlet_diffmax;
Diffmax = Diffmax > 0 ? Diffmax : -Diffmax;
int32_t LP = param_LP + inlet_LP;
int32_t HP = param_HP + inlet_HP;
int32_t FD = __USAT(param_feedback + inlet_feed, 27);

int32_t F;
int32_t G;
MTOF(LP, F)
MTOF(HP, G)

stepMax = (Max - prevMax) >> 4;
stepBias = (Bias - prevBias) >> 4;
stepMin = (Min - prevMin) >> 4;
stepDiffmax = (Diffmax - prevDiffmax) >> 4;
stepF = (F - prevF) >> 4;
stepG = (G - prevG) >> 4;
stepfb = (FD - prevfb) >> 4;

int32_t max = prevMax;
int32_t bias = prevBias;
int32_t min = prevMin;
int32_t diffmax = prevDiffmax;
int32_t f = prevF;
int32_t g = prevG;
int32_t feedback = prevfb;

prevMax = Max;
prevBias = Bias;
prevMin = Min;
prevDiffmax = Diffmax;
prevF = F;
prevG = G;
prevfb = FD;
Audio Rate
int32_t in = inlet_in + bias + ___SMMUL(feedback << 4, temp << 3);
in = in > max ? max : in;
in = in < min ? min : in;
int32_t DIFF = inlet_in - in;
DIFF = DIFF > diffmax ? diffmax : DIFF;
DIFF = DIFF < -diffmax ? -diffmax : DIFF;

val1 = ___SMMLA((DIFF - val1) << 1, f, val1);
val2 = ___SMMLA((val1 - val2) << 1, g, val2);
temp = val1 - val2 + in;
val3 = val3 + ((temp - val3) >> 10);
temp = temp - val3;
outlet_out = temp;

max += stepMax;
bias += stepBias;
min += stepMin;
diffmax += stepDiffmax;
f += stepF;
g += stepG;
feedback += stepfb;

Privacy

© 2024 Zrna Research