coloured

Coloured noise based on 2 biquad allpass filters that can be added or subtracted to get LP/HP/BP/NOTCH/PEAK/LOWSHELF/HIGHSHELF filtered noise
Author: Remco van der Most
License: BSD
Github: sss/noise/coloured.axo

Inlets

frac32 center

frac32 width

frac32 side1

frac32 side2

frac32 invert

Outlets

frac32buffer noise

Parameters

frac32.s.map width

frac32.s.map side1

frac32.s.map side2

frac32.s.map invert

frac32.u.map center

Declaration
int32_t All;
int32_t bs[4][2];
uint32_t v30 = 1 << 30;
uint32_t v27 = 1 << 27;
uint32_t v23 = 1 << 25;
uint32_t v8 = 1 << 8;
int32_t noise;
int32_t Frq[4];
int32_t RMS;
int32_t ALLPASS(int32_t in, int I) {
  bs[I][1] =
      ___SMMUL(-in << 1, Frq[I]) + bs[I][0] + ___SMMUL(bs[I][1] << 1, Frq[I]);
  All = bs[I][1];
  bs[I][0] = in;
}
Init
RMS = v30;
noise = 0;
Control Rate
int32_t center = param_center + inlet_center;
int32_t width = param_width + inlet_width;

SINE2TINTERP(__SSAT(v27 - center - width, 28) << 3, Frq[0])
SINE2TINTERP(__SSAT(v27 - center + width, 28) << 3, Frq[1])
int32_t inv = __SSAT(param_invert + inlet_invert, 28);
int32_t side1 = __SSAT(param_side1 + inlet_side1, 28);
int32_t side2 = __SSAT(param_side2 + inlet_side2, 28);
Audio Rate
noise = ((int32_t)(GenerateRandomNumber()) >> 3) + noise >> 3;
int32_t NS = noise;
ALLPASS(noise, 0);
noise -= (___SMMUL(side1 << 4, All) << 1);
ALLPASS(noise, 1);
noise -= (___SMMUL(side2 << 4, All) << 1);
int32_t ns = noise - ___SMMUL(inv << 3, NS << 2);
int32_t ts = ns;
ts = ts > 0 ? ts : -ts;
ts = ts < v8 ? v8 : ts;
RMS += ((ts - RMS) >> 8);
outlet_noise = (int32_t)(ns * ((float32_t)v23 / RMS));

Privacy

© 2024 Zrna Research