armMOD

Audio rate modulator meant to be used with an audio-rate modulatable filter phase input reads from internal interpolated table so a waveform (eg. my complexSH oscillitor)can be filtered differently over the course of it's phase to further alter the spectral content of the waveform.
Author: Remco van der Most
License: BSD
Github: sss/filter/armMOD.axo

Inlets

frac32buffer connect to phase output of an oscillator (or add to the S-rate code: outlet_phase=Phase>>5; and add an audio outlet called "phase")

frac32buffer offsets the phase readout (eg. use an envelope or lfo for slow modulation)

frac32 connect to the pitch of the oscillator to enable pitch-tracking (or velocity whatever..)

frac32 external control of table length in powers of 2 (same as knob)

bool32 randomises modulation table

Outlets

frac32buffer o

Parameters

frac32.u.map.gain modulation output width

frac32.u.map.gain adds the pitch input to the output

frac32.u.map controls table readout length in power of 2. smallest size is 2 steps (single pulse), biggest size is max table size

Attributes

combo size

Declaration
static const uint32_t LENGTHPOW = (attr_size);
static const uint32_t LENGTH = (1 << attr_size);
static const uint32_t LENGTHMASK = ((1 << attr_size) - 1);
static const uint32_t BITS = 16;
static const uint32_t GAIN = 12;
int16_t *array;
int rnd;
int32_t hp;
Init
static int16_t _array[attr_poly][LENGTH] __attribute__((section(".sdram")));
array = &_array[parent->polyIndex][0];
{
  int i;
  for (i = 0; i < LENGTH; i++) {
    array[i] = (int32_t)(GenerateRandomNumber()) >> 16;
  }
}
Control Rate
if (inlet_rnd && !rnd) {
  rnd = 1;
  for (int i = 0; i < LENGTH; i++) {
    array[i] = (int32_t)(GenerateRandomNumber()) >> 16;
  }
} else if (!inlet_rnd) {
  rnd = 0;
}
int32_t LP =
    1 + ___SMMUL(__USAT(param_length + inlet_length, 27) << 4, attr_size << 1);
int32_t LM = (1 << LP) - 1;
Audio Rate
uint32_t asat = (inlet_phase + inlet_offset) & ((1 << 27) - 1);
int index = asat >> (27 - LP);
int32_t y1 = array[index] << 12;
int32_t y2 = array[(index + 1) & LM] << 12;
int frac = (asat - (index << (27 - LP))) << (LP + 3);
int32_t rr;
rr = ___SMMUL(y1, (1 << 30) - frac);
rr = ___SMMLA(y2, frac, rr);
rr = ___SMMUL(param_mw, (rr << 3));
hp += rr - hp >> 9;

outlet_o = rr - hp + ___SMMUL(inlet_pitch << 1, param_track);

Privacy

© 2024 Zrna Research