table1D

DON'T FORGET TO ADD AN ENVELOPE/VOLUME CONTROL AT THE "ENV" INPUT!!! wavetable oscillator that can linearyly morph through the table in a set amount of steps and stepsize. loads wavetables created with the "TheCreator" module. Has external frequency modulation, phase modulation and sync. -hrm and div allow to set the oscillator to a ratio to the root-pitch -extFM controls the external FM width -waveform offsets the startposition of the table readout -LP dampens the high frequencies/smooths waveform -mix controls the morph through the wavetable AND harmonic ratio offsets -step sets the stepsize with which you morph through the table -quant sets the amount of waveforms you go through with the mix-control -Mstep controls the stepsize of the harmonic multiplier -Mrng sets the maximum harmonic multiplier that can be reached -Dstep sets the stepsize of the harmonic division -Drng sets the maximum harmonic division that can be reached
Author: Remco van der Most
License: BSD
Github: sss/osc/table1D.axo

Inlets

frac32 mix

frac32 env

frac32.bipolar pitch

frac32buffer frequency

frac32buffer phase

frac32buffer sync

int32 waveform

int32 step

int32 Mstep

int32 Dstep

Outlets

int32 divide

frac32buffer.bipolar wave

Parameters

frac32.u.map mix

bool32.tgl sync

bool32.tgl S

bool32.tgl R

bool32.tgl Z

frac32.s.map.pitch root

frac32.s.map.pitch LP

frac32.s.map.pitch rate

int32 hrm

int32 div

int32 waveform

int32 step

int32 quant

int32 Mstep

int32 Mrng

int32 Dstep

int32 Drng

frac32.s.map extFM

frac32.s.map PM

Attributes

objref table

Declaration
uint32_t PhaseA;
uint32_t PhaseB;
int32_t mix[2];
int32_t ccomp;
int32_t read1;
int32_t read2;
int32_t P[6];
int i;
int Strig;
int32_t wave;
int32_t smooth;
int32_t F;
int32_t tableOsc(int32_t inst, int32_t PhsA, int32_t PhsB, int32_t preset1a,
                 int32_t preset1b, int32_t Mix) {
  read1 =
      attr_table
          .array[(((PhsA)&1023) + ((preset1a) << 10)) & attr_table.LENGTHMASK];
  read2 =
      attr_table
          .array[(((PhsB)&1023) + ((preset1b) << 10)) & attr_table.LENGTHMASK];
  ccomp = (1 << 27) - Mix;
  mix[inst] = ___SMMUL(ccomp << 3, read1 << 2) + ___SMMUL(Mix << 3, read2 << 2);
};
int32_t tablemix(int32_t inst, int32_t WaveA, int32_t WaveB, int32_t Mix) {
  mix[inst] = ___SMMUL(((1 << 27) - Mix) << 3, WaveA << 2) +
              ___SMMUL(Mix << 3, WaveB << 2);
}

uint64_t MIX1;
uint64_t MIX2;
uint64_t MIX3;
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 freq;
int32_t FreqA;
int32_t FreqB;
int32_t phaseA;
int32_t phaseB;
uint32_t Sync;
Init
PhaseA = 0;
PhaseB = 0;
Control Rate
int32_t rate;
MTOFEXTENDED(param_rate, rate)
rate = -rate;
int16_t Preset = (param_waveform + inlet_waveform) & 1023;

MIX1 = param_mix + inlet_mix;
MX(MIX1);
MIX1 = F;

P[0] = ((((MIX1 * param_quant) >> 27) + 1) >> 1) << 1;
P[1] = (((MIX1 * param_quant) >> 28) << 1) + 1;
MIX1 =
    (MIX1 - (((MIX1 * param_quant) >> 28) << 28) / param_quant) * param_quant;
MIX1 = MIX1 > (1 << 27) ? ((2 << 27) - MIX1) : MIX1;
P[2] = P[0] * (param_Mstep + inlet_Mstep);
P[3] = P[1] * (param_Mstep + inlet_Mstep);
P[2] = (P[2] - (P[2] / param_Mrng) * param_Mrng) + 1;
P[3] = (P[3] - (P[3] / param_Mrng) * param_Mrng) + 1;
P[4] = P[0] * (param_Dstep + inlet_Dstep);
P[5] = P[1] * (param_Dstep + inlet_Dstep);
P[4] = (P[4] - (P[4] / param_Drng) * param_Drng) + 1;
P[5] = (P[5] - (P[5] / param_Drng) * param_Drng) + 1;
P[0] = P[0] * (param_step + inlet_step) + Preset;
P[1] = P[1] * (param_step + inlet_step) + Preset;

int32_t f;
MTOF(param_LP, f)
MTOFEXTENDED(param_root + inlet_pitch, freq);
int32_t Afreq = (freq * (param_hrm) / param_div) * P[2] / P[4];
int32_t Bfreq = (freq * (param_hrm) / param_div) * P[3] / P[5];
outlet_divide = param_quant;
Audio Rate
if (((param_sync > 0) & (inlet_sync > 0)) && !Strig) {
  if (param_S > 0) {
    PhaseA = 0;
    PhaseB = 0;
  }
  if (param_R > 0) {
    PhaseA += rate;
    PhaseB += rate;
  }
  if (param_Z > 0) {
    PhaseA += Sync;
    PhaseB += Sync;
  }
  Sync += rate;
  Strig = 1;
} else if (inlet_sync < 1) {
  Strig = 0;
}

FreqA = Afreq +
        ___SMMUL(___SMMUL(inlet_extFM << 4, param_extFM << 4) << 3, Afreq << 4);
FreqB = Bfreq +
        ___SMMUL(___SMMUL(inlet_extFM << 4, param_extFM << 4) << 3, Bfreq << 4);
PhaseA += FreqA;
PhaseB += FreqB;
phaseA = (PhaseA + (___SMMUL(inlet_phase << 3, param_PM << 2) << 4)) >> 22;
phaseB = (PhaseB + (___SMMUL(inlet_phase << 3, param_PM << 2) << 4)) >> 22;
tableOsc(0, phaseA, phaseB, P[0], P[1], MIX1);
mix[0] = ___SMMUL(mix[0] << 3, inlet_env << 2);
tablemix(0, mix[0], mix[1], MIX2);
smooth = __SMMLA((mix[0] - smooth) << 1, f, smooth);
outlet_wave = smooth;

Privacy

© 2024 Zrna Research