tappedDelay

multi-tap delay with lowpass filter on each tap. You enter the tap-velocity/timing/cutoff for each tap by external tapping. eg. when using a midi note module: connect gate-output of midi module to the tap-input of this module connect note-output of midi module to the cutoft-input of this module connect velocity-output of midi module to the vel-input of this module first tap you play will reset the timing-counter to the "zero" position->incoming note taps after this will set the timing/velocity/cutoff of the delays. when you want to set new timings for the delay, just hit "rst" and play a new rhythm. on-module cutoff-knob is added to the recorded cutoff.
Author: Remco van der Most
License: BSD
Github: sss/delay/tappedDelay.axo

Inlets

bool32 rst

bool32 tap

frac32 cutoff

frac32 vel

frac32 feed

frac32buffer wave input

Outlets

frac32buffer out

Parameters

frac32.s.map feed

bool32.mom rst

frac32.s.map.pitch cutoff

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);
int16_t *array;
uint32_t writepos;
int delays;
int32_t times[16];
int32_t velocity[16];
int32_t f[16];
int32_t g[16];
int32_t val[16];
int gtrig;
int rtrig;
uint32_t count = 0;
int start;
int i;
int32_t out;
Init
static int16_t _array[1 << attr_size] __attribute__((section(".sdram")));
array = &_array[0];
writepos = 0;
for (i = 0; i < LENGTH; i++)
  array[i] = 0;
delays = 0;
start = 1;
Control Rate
int rst = inlet_rst + param_rst;
if ((rst > 0) && !rtrig) {
  delays = 0;
  start = 1;
  rtrig = 1;
} else if (rst == 0) {
  rtrig = 0;
}
if ((inlet_tap > 0) && !gtrig) {
  if (start == 1) {
    count = 0;
    start = 0;
  }
  if (delays > 0) {
    times[delays - 1] = count;
    // MTOF(inlet_cutoff+param_cutoff,f[delays-1])
    g[delays - 1] = inlet_cutoff;
    velocity[delays - 1] = inlet_vel << 2;
  }
  delays += 1;
  gtrig = 1;
} else if (inlet_tap == 0) {
  gtrig = 0;
}
int32_t feed = __SSAT(param_feed + inlet_feed, 27);
if (delays > 0) {
  for (i = 0; i < (delays - 1); i++) {
    MTOF(g[i] + param_cutoff, f[i])
  }
}
Audio Rate
writepos = (writepos + 1) & LENGTHMASK;
array[writepos] = __SSAT((inlet_in + ___SMMUL(feed << 2, out << 2)) >> 16, 16);
count += 1;
out = 0;
int32_t tmp;
if (delays > 0) {
  for (i = 0; i < (delays - 1); i++) {
    tmp =
        ___SMMUL(array[(writepos - times[i]) & LENGTHMASK] << 19, velocity[i]);
    val[i] = ___SMMLA((tmp - val[i]) << 1, f[i], val[i]);
    out += val[i];
  }
}
outlet_out = out + inlet_in;

Privacy

© 2024 Zrna Research