grainShifter

Sample buffer referencing a 32b table. Each time carrier input rises above zero the buffer recording position is restarted. A This results in a granular pitch shifter. Feed the audio to be recorded into the carrier input and the "phase" into the modulator (or any other waveshape for all I care)
Author: Remco van der Most
License: CC0
Github: sss/fx/grainShifter.axo

Inlets

frac32buffer audio input

frac32buffer.positive Modulator

Outlets

frac32buffer oldest sample output

Attributes

objref table1

Declaration
uint32_t pos;
int32_t last_input;
int32_t val_out;
int32_t val_target;
int32_t accu;
int32_t sampleno;
int tra;
int64_t i;
int64_t length;
int64_t read;

uint64_t phase;
uint64_t phrase;
int64_t val;
int64_t ctrl1;
int64_t ctrl2;
int32_t ctrl3;
int64_t next1;
int64_t next2;
int64_t next3;
int64_t prev;
int64_t ccomp;
int64_t tri;
int trg;
int64_t dir;
int64_t val2;
int64_t out;
Init
last_input = 0;
pos = 0;
val_out = 0;
val_target = 0;
accu = 0;
sampleno = 0;
Audio Rate
pos = (pos + 1) & attr_table1.LENGTHMASK;
read = inlet_Modulator;
val_target =
    attr_table1.array[((read * length) >> 27) & attr_table1.LENGTHMASK];
attr_table1.array[pos] = __SSAT(accu / sampleno, 28);

accu = 0;
sampleno = 0;
if ((inlet_Carrier > 0) & (!(tra))) {
  length = pos;
  pos = 0;
  tra = 1;
}
if (inlet_Carrier < 0) {
  tra = 0;
}
last_input = inlet_Modulator;
accu += inlet_Carrier;
sampleno++;
val_out = (val_out + val_out + val_out + val_target) >> 2;
outlet_out = val_out;

Privacy

© 2024 Zrna Research