repeater2St

version 2 of the audio repeater module. Can be used in-line in your audio-chain and doesn't need an external delay write module. when input "on" goes high, starts repeating the incoming audio for the number of repeats set by the input. Repeating size is set by the size and swing inlets. -size/swing are used to set the size in samples (48k/s). -Ksize/Kswing are used to set the size in the fractional 0-64 way eg. for the Ksize/Kswing you can use my "BPMext" LFO to provide the "delaybase" timing. Then use the math/ratios235 module to set a division based on 2, 3 and 5 integers (any combination in nominator and denominator). This way you could, for example, set a main retrigger in fourths, but give every even numbered retrigger an offset in thirds. the repeat input sets the amount of times the buffer is repeated as long as the "on" input is high. After that, a new sample is taken which itself will be repeated the set amount of times before another sample is taken again. Bit of a drawback of the way the module is coded, is that there is no pitch-control possible. Use the "grainer" module if you want pitch-control
Author: Remco van der Most
License: BSD
Github: sss/delay/repeater2St.axo

Inlets

bool32 when high, repeater is on

bool32 triangle/saw shape for panning wrap

int32 Sets the base delay-time in samples. Connects to "Ksamples" on my clock2timing module. Use ratioVCAI to set ratio to host tempo

int32 Sets swing-time in samples for every even numbered repetition. Connects to "Ksamples" on my clock2timing module. Use ratioVCAI to set ratio to host tempo

int32 sets the amount of repetitions

frac32 sets the base repeat-time in fractional value. Use BPMext "delaybase" ouput to host sync to the lfo. Use my ratio modules for integer divisions of host tempo.

frac32 sets the swing-time in fractional valueof every even numbered repetition. Use BPMext "delaybase" ouput to host sync to the lfo. Use my ratio modules for integer divisions of host tempo.

frac32 sets the volume of the repeats

frac32 feeds back the repeater (hard clipped with input)

frac32 sets the start panning of the repeat

frac32 offsets the panning of each next repeat

frac32 negative value will make the pan go from outwards from the first repeat to center at the last repeat, zero is no swell, positive values will make the pan move from center from the first repeat to outwards at the last repeat

frac32 damp

frac32 dampSwell

frac32buffer audio input

Outlets

frac32buffer outL

frac32buffer outR

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);
int32_t *array;
uint32_t writepos;
int32_t size;
int32_t times;
int32_t rec;
int32_t out;
int32_t Ol;
int32_t Or;
int32_t repeat;
int32_t swing;
int32_t pan[16];
int32_t lp[16];
int32_t rate[16];
int32_t v27 = 1 << 27;
int32_t v28 = 1 << 28;
int32_t vi29 = (1 << 29) - 1;
int i;
Init
static int32_t _array[attr_poly][1 << attr_size]
    __attribute__((section(".sdram")));
array = &_array[parent->polyIndex][0];
writepos = 0;
for (i = 0; i < LENGTH; i++)
  array[i] = 0;
Control Rate
size = ___SMMUL(__USAT(inlet_Ksize, 27) << 3, LENGTH << 2) + inlet_size;
size = size > 0 ? size : -size;
size = size > 0 ? size : 1;
swing = ___SMMUL(__USAT(inlet_Kswing, 27) << 3, LENGTH << 2) + inlet_swing;
repeat = inlet_repeat;
repeat = repeat > 0 ? repeat : 1;
repeat = repeat > 16 ? 16 : repeat;

for (i = 0; i < repeat; i++) {
  int32_t tmp = (inlet_panStart << 4) + (inlet_panSpread / repeat << 6) * i;
  if (inlet_panMode < 1) {
    int32_t tp = __SSAT(tmp, 30);
    pan[i] = tp - (tp - tmp) << 1;
  } else {
    pan[i] = tmp;
  }
  pan[i] += ___SMMUL(inlet_panSwell * (i - (repeat >> 1)), pan[i]) << 5;
  MTOF(inlet_damp + (inlet_dampSwell >> 1) * i, rate[i])
}
Audio Rate
writepos = (writepos + 1) & LENGTHMASK;
array[writepos] = inlet_on > 0
                      ? __SSAT(inlet_in + ___SMMUL(inlet_feed << 3, out << 2),
                               28)
                      : 0;
out = 0;
Ol = 0;
Or = 0;
if (inlet_on > 0) {
  for (i = 1; i <= repeat; i++) {
    int k = i - 1;
    out = ___SMMUL(
        array[(writepos - i * size + ((i - 1) & 1) * swing) & LENGTHMASK] << 2,
        inlet_wet << 2);
    lp[k] = ___SMMLA(out - lp[k] << 1, rate[k], lp[k]);
    out = lp[k];
    Ol = __SSAT(out + ___SMMUL(out << 1, pan[k]) + Ol, 28);
    Or = __SSAT(out - ___SMMUL(out << 1, pan[k]) + Or, 28);
    out = __SSAT((Ol + Or) / repeat, 28);
  }
}

outlet_outL = __SSAT(inlet_in + Ol, 28);
outlet_outR = __SSAT(inlet_in + Or, 28);

Privacy

© 2024 Zrna Research