multiRepeater

multi repeating delay -features multiple write and read position to create a repeating effect inputs: -in1: this is fed into both the first delay-writer as the following "repeater" delay-writers (stacks with multiple readers) -in2: this is fed only to the first delay-writer, so only repeats according to the amount of "repeating" delay readers. controls/inputs: -timeWrite: maximum writing time (all written repeats are within this time) -timeRead: maximum reading time (all read repeats are within this time) -repeatWrite: repeats the writer this many times in the given reading time with an equal offset between all writers (timeRead) -repeatRead: repeats the reader this many times in the given reading time with an equal offset between al writers(timeRead) -freeze: freezes the writing process of the delay, causing the readers to keep repeating what's in the buffer. Time offsetting the reading-process: -startNom: sets the multiplication of the total writeTime -startDiv: sets the division of the multiplied total writeTime. This read-offset is used for offsetting the reading-process by a division of the writing time. This way, you can easily making a complex shuffling delay which keeps track of the writing-rate, filling in the gaps.
Author: Remco van der Most
License: BSD
Github: sss/delay/multiRepeater.axo

Inlets

frac32buffer wave input

frac32buffer in2

frac32 timeRead

frac32 timeWrite

int32 repeatRead

int32 repeatWrite

int32 startNom

int32 startDiv

bool32 freeze

Outlets

int32 pow

frac32buffer out

Parameters

frac32.u.map timeWrite

frac32.u.map timeRead

int32 repeatWrite

int32 repeatRead

int32 startNom

int32 startDiv

frac32.s.map wet

bool32.tgl freeze

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;
int i;
uint32_t Timeread;
uint32_t Timewrite;
int64_t TIME;
Init
static int32_t _array[1 << attr_size] __attribute__((section(".sdram")));
array = &_array[0];

writepos = 0;
for (i = 0; i < LENGTH; i++)
  array[i] = 0;
Control Rate
int freeze = param_freeze + inlet_freeze;
int repeatread = param_repeatRead + inlet_repeatRead;
int repeatwrite = param_repeatWrite + inlet_repeatWrite;
int startNom = param_startNom + inlet_startNom;
int startDiv = param_startDiv + inlet_startDiv;
if (freeze == 0) {
  TIME = inlet_timeWrite + param_timeWrite;
  TIME = (TIME * startNom / startDiv) >> (27 - LENGTHPOW);
  Timeread = (param_timeRead + inlet_timeRead) >> (27 - LENGTHPOW);
  Timewrite = (param_timeWrite + inlet_timeWrite) >> (27 - LENGTHPOW);
}

outlet_pow = attr_size;
Audio Rate
uint32_t delayread = writepos - Timeread;
uint32_t delaywrite = writepos - Timewrite;
int32_t sum = 0;
writepos = (writepos + 1) & LENGTHMASK;
if (freeze == 0) {
  array[writepos] = inlet_in1 + inlet_in2;
}

for (i = 1; i < repeatread + 1; i++) {
  sum += array[(writepos - Timeread / repeatread * i) & LENGTHMASK];
}
if (freeze == 0) {
  for (i = 1; i < repeatwrite; i++) {
    array[(writepos - Timeread / repeatwrite * i - TIME) & LENGTHMASK] +=
        inlet_in1;
  }
}
// for(i=1;i<repeatread;i++){
// sum=array[(writepos-Timeread)& LENGTHMASK];}
outlet_out = ___SMMUL(sum << 3, param_wet << 2) + inlet_in1 + inlet_in2;

Privacy

© 2024 Zrna Research