repeater2

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/repeater2.axo

Inlets

frac32buffer in

bool32 on

int32 connect to "Ksamples" on my clock2timing module. Use ratioVCAI to set ratio to host tempo

int32 swing

int32 repeat

frac32 Ksize

frac32 Kswing

frac32 wet

frac32 feed

Outlets

frac32buffer out

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 repeat;
int32_t swing;

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;
Audio Rate
writepos = (writepos + 1) & LENGTHMASK;
array[writepos] = inlet_on > 0
                      ? __SSAT(inlet_in + ___SMMUL(inlet_feed << 3, out << 2),
                               28)
                      : 0;
out = 0;
if (inlet_on > 0) {
  for (i = 1; i <= repeat; i++) {
    out = __SSAT(
        out + ___SMMUL(array[(writepos - i * size + ((i - 1) & 1) * swing) &
                             LENGTHMASK]
                           << 2,
                       inlet_wet << 3),
        28);
  }
}

outlet_out = __SSAT(inlet_in + out, 28);

Privacy

© 2024 Zrna Research