tableOsc2

table oscillator Version2. Addapted to be used with the wavetables created with the Creator module (creates 1024 waves in a single wavetable). Can use the tables created by the "sculptor" module or any other "raw" table data. Inputs (same as corresponding parameters) "pitch"->enter your pretty melody data in here ;) "freq" input for audio rate fm "Shift" shifts the start readout point through the table. "size" sets the readout width by the phase "mix" controls the sine/table mix "root" sets the harmonic ratio of the sine "harmonic" sets the harmonic ratio of the table oscillator "fm" controls fm-width for "freq" input "p2size" sends pitch data to offset the readout-size "p2shift" sends pitch data to offset the start position of the readout "cut" sets the pitch-offset of a 12dB LP-filter in respect to the incoming pitch data to smooth out the table.
Author: Remco van der Most
License: BSD
Github: sss/osc/tableOsc2.axo

Inlets

frac32 pitch

frac32 shift

frac32 size

frac32 mix

frac32buffer phase increment

bool32 active

Outlets

frac32buffer out

Parameters

frac32.s.map.pitch pitch

int32 root

int32 harmonic

frac32.s.map fm

frac32.s.map p2size

frac32.s.map p2shift

frac32.s.map size

frac32.u.map shift

frac32.u.map cut

Attributes

objref table

Declaration
uint32_t Phase;
int32_t shift;
int32_t tap;
int32_t val1;
int32_t val2;
int32_t out;
int i;
int32_t offset1;
int32_t offset2;
int32_t offset3;
int32_t index;
int32_t mix;
uint32_t freq;
int32_t cut;
Init
Phase = 0;
val1 = 0;
val2 = 0;
Control Rate
if (inlet_active > 0) {
  MTOFEXTENDED(param_pitch + inlet_pitch, freq);
  freq = freq;

  MTOF(__USAT(param_pitch + param_cut, 27), cut);
  cut = cut * param_harmonic;
  offset1 = ___SMMUL((param_pitch + inlet_pitch + (1 << 26)) << 3,
                     param_p2shift << 2);
  offset2 = ___SMMUL((param_pitch + inlet_pitch + (24 << 21)) << 3,
                     param_p2size >> 4) +
            param_size + inlet_size;
}
Audio Rate
if (inlet_active > 0) {
  offset3 = offset3 + ((offset2 - offset3) >> 8);
  mix = mix + ((inlet_mix - mix) >> 8);
  out = 0;
  Phase += (freq >> 0) + ___SMMUL(inlet_freq << 3, param_fm);
  shift =
      shift + ((((param_shift + inlet_shift + offset1) >> 7) - shift) >> 10);
  index = (___SMMUL(((Phase * param_harmonic) >> 9), offset3 << 3) >> 11) +
          ((shift) >> 3);
  tap = attr_table.array[((index) << 1) & ((1 << 20) - 1)] >> 2;
  val1 = ___SMMLA(((tap << 2) - val1) << 1, cut, val1);
  val2 = ___SMMLA((val1 - val2), cut, val2);
  int32_t sine;
  SINE2TINTERP(Phase * param_root, sine)
  outlet_out =
      ___SMMUL(val2 << 3, mix << 3) + ___SMMUL((1 << 27) - (mix), sine);
}

Privacy

© 2024 Zrna Research