fifthshifter2

this is a dual-delayline pitchshifter/delay with 6dB crossover filters. The low frequency region will be pitched up by a fifth, the high frequency region will be pitched down by an octave. The "crossover" parameter sets the crossover frequency for the input, to send low frequencies to the fifth-up and high frequencies to the octave-down delayline. After each delayline there is a seperate 6dB crossover filter that sends the feedback to either up/down delayline when the audio passes the cutoff frequency. This way a frequency band can be set between which the audio will be pitched up/down in the feedback path. Mostly usable for drony stuff.
Author: Remco van der Most
License: BSD
Github: sss/delay/fifthshifter2.axo

Inlets

frac32buffer wave input

frac32 crossover

frac32 rate

frac32 allL

frac32 allH

Outlets

frac32buffer outL

frac32buffer outR

Parameters

frac32.s.map.pitch sets "mid" crossover frequency. The pitchshifter/delay will mostly focus around this point

frac32.s.map.pitch lowest

frac32.s.map.pitch highest

frac32.u.map allL

frac32.u.map allH

frac32.s.map.lfopitch panRate

frac32.u.map.gain feed

frac32.u.map.gain dry

frac32.u.map.gain wet

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 *arrayL;
int16_t *arrayH;
uint32_t writepos;
uint32_t readL;
uint32_t readH;
int32_t low;
int32_t high;
int32_t feedL;
int32_t feedH;
int32_t lp1;
int32_t lp2;
int32_t v27 = 1 << 27;
int32_t All;
int32_t bs[2][2];
int32_t Frq[2];
int32_t ALLPASS(int32_t in, int I) {
  bs[I][1] =
      ___SMMUL(-in << 1, Frq[I]) + bs[I][0] + ___SMMUL(bs[I][1] << 1, Frq[I]);
  All = bs[I][1];
  bs[I][0] = in;
}
uint32_t LFO;
Init
static int16_t _arrayL[1 << attr_size] __attribute__((section(".sdram")));
arrayL = &_arrayL[0];
static int16_t _arrayH[1 << attr_size] __attribute__((section(".sdram")));
arrayH = &_arrayH[0];
int i;
writepos = 0;
for (i = 0; i < LENGTH; i++) {
  arrayL[i] = 0;
  arrayH[i] = 0;
}
Control Rate
int32_t frq;
MTOF(param_crossover + inlet_crossover, frq)
int32_t LOW;
int32_t HIGH;
MTOF(param_highest, LOW)
MTOF(param_lowest, HIGH)

SINE2TINTERP(__SSAT(v27 - param_allL - inlet_allL, 28) << 3, Frq[0])
SINE2TINTERP(__SSAT(v27 - param_allH - inlet_allH, 28) << 3, Frq[1])
int32_t rate;
MTOFEXTENDED(param_panRate + inlet_rate - (12 << 3), rate)
rate = rate >> 3;
Audio Rate
LFO += rate;
int32_t sine;
SINE2TINTERP(LFO, sine)
sine = (sine >> 3) + (1 << 29);
int32_t in = __SSAT(inlet_in, 28); //+___SMMUL(-feed<<1,param_feed)
low = ___SMMLA((in - low) << 1, frq, low);
high = in - low;
writepos = (writepos + 1) & LENGTHMASK;
arrayL[writepos] = __SSAT(low + feedL >> 14, 16);
arrayH[writepos] = __SSAT(high + feedH >> 14, 16);
readL = (readL + 2) & LENGTHMASK;
readH = (readH + 1) & LENGTHMASK;
int32_t outLA = arrayL[(writepos + readL) & LENGTHMASK] << 14;
int32_t outLB =
    arrayL[(writepos + ((readL + (LENGTH >> 1) & LENGTHMASK))) & LENGTHMASK]
    << 14;
int32_t outHA = arrayH[(writepos - (readH >> 1)) & LENGTHMASK] << 14;
int32_t outHB =
    arrayH[(writepos - ((readH + (LENGTH >> 1) & LENGTHMASK) >> 1)) &
           LENGTHMASK]
    << 14;
int32_t mixL = readL > (LENGTH >> 1) ? LENGTH - readL : readL;
mixL = mixL << 31 - LENGTHPOW;
int32_t mixH = readH > (LENGTH >> 1) ? LENGTH - readH : readH;
// mixH=mixH>>1;
mixH = mixH << 31 - LENGTHPOW;
int32_t LW = (outLB + ___SMMUL(outLA - outLB << 2, mixL));
int32_t HG = (outHB + ___SMMUL(outHA - outHB << 2, mixH));
int32_t OUT = LW + HG;
int32_t dry = __SSAT(___SMMUL(inlet_in << 1, param_dry), 28);
outlet_outL = __SSAT(
    dry +
        __SSAT(___SMMUL(LW + ___SMMUL(HG - LW << 2, sine) << 1, param_wet) << 1,
               28),
    28);
outlet_outR = __SSAT(
    dry +
        __SSAT(___SMMUL(HG + ___SMMUL(LW - HG << 2, sine) << 1, param_wet) << 1,
               28),
    28);
lp1 = ___SMMLA((LW - lp1) << 1, LOW, lp1);
lp2 = ___SMMLA((HG - lp2) << 1, HIGH, lp2);
feedL = -___SMMUL(lp1 + lp2, param_feed) << 1;
feedH = -___SMMUL((HG - lp2) + (LW - lp1), param_feed) << 1;
ALLPASS(feedL, 0);
feedL = All;
ALLPASS(feedH, 1);
feedH = All;

Privacy

© 2024 Zrna Research