tableShape

Interpolated wavetable shaper. Turns a phase (phazor oscillator, positive non-bandlimited saw-wave) into a wave using a morphable wavetable. "mix" morphs through the available waveforms in the wavetable "start" is the "base" waveform, where it will start when "mix" is at minimum or maximum. "step" is the stepsize for selecting from the waveforms while morphing with the "mix". Last step is always the same as the first step, so you could use a saw to morph through the waveforms continuously in one direction. "harmonic" multiplies the incoming phase to generate higher harmonic waveforms based on root phase. "quant" sets the amount of waveforms that the mix will morph through. At 64, it will morph back to the "base" waveform. This module pairs very VERY well with the other shape modules for lots of tonal control!
Author: Johannes Taelman
License: BSD
Github: sss/shape/tableShape.axo

Inlets

frac32buffer delay time (fraction of total delayline size)

frac32 mix

int32 step

Outlets

frac32buffer wave

int32 div

Parameters

int32 harmonic

int32 quant

int32 start

int32 step

frac32.u.map mix

Attributes

objref table

Declaration
int32_t mix;
int32_t tablemix(int32_t WaveA, int32_t WaveB, int32_t Mix) {
  mix = ___SMMUL(((1 << 27) - Mix) << 3, WaveA << 2) +
        ___SMMUL(Mix << 3, WaveB << 2);
}
int32_t F;
int32_t MX(int32_t T) {
  T = T > 0 ? T : -T;
  T = T & ((1 << 28) - 1);
  F = T > (1 << 27) ? (1 << 28) - T : T;
}
int32_t MIX1a;
int32_t MIX1;
int32_t W[2];
int32_t out1;
int32_t out2;
int32_t smooth1;
int32_t M1step;
int32_t M1prv;
int i;
Control Rate
int32_t MiX1 = inlet_mix + param_mix;
// MX(MiX1);
// MiX1=F;
MiX1 = MiX1 & ((1 << 27) - 1);

int32_t quant = param_quant + 1;
float32_t step =
    ((float32_t)(attr_table.Waveforms)) / (quant) * (inlet_step + param_step);

outlet_div = quant;

MIX1a = MiX1;

W[0] = ((MIX1a >> 4) * quant) >> 23;
MIX1a = (MIX1a - (W[0] << 27) / quant) * quant;
W[1] = W[0] * step + step + param_start;
W[0] = W[0] * step + param_start;

for (i = 0; i < 2; i++) {
  W[i] = (W[i] - (W[i] / attr_table.Waveforms) * attr_table.Waveforms);
  W[i] = W[i] < 0 ? W[i] + attr_table.Waveforms : W[i];
  W[i] = W[i] * attr_table.LENGTH;
}
Audio Rate
uint32_t phase = inlet_phase * param_harmonic << 5;
uint32_t p1 = (phase >> 32 - attr_table.LENGTHPOW);
uint32_t Mit = ((phase << attr_table.LENGTHPOW) >> 2) & 0x3FFFFFFF;
int32_t out1;
int32_t out2;

out1 = ___SMMUL(attr_table.array[p1 + W[0]] << 2, (1 << 30) - Mit);
out1 += ___SMMUL(
    attr_table.array[((p1 + 1) & attr_table.LENGTHMASK) + W[0]] << 2, Mit);
out2 = ___SMMUL(attr_table.array[p1 + W[1]] << 2, (1 << 30) - Mit);
out2 += ___SMMUL(
    attr_table.array[((p1 + 1) & attr_table.LENGTHMASK) + W[1]] << 2, Mit);

tablemix(out1, out2, MIX1a);
outlet_out = mix;

Privacy

© 2024 Zrna Research