tablemorph2

DON'T FORGET TO CONNECT AN ENVELOPE OF VOLUME CONTROL TO THE "env1 to 4" INPUTS!! quad wavetable oscillator loads wavetables created with the "TheCreator" module. each oscillator can play at it's own harmonic based on it's own pitch. -quant controls how many waves will be morphed through using the corresponding mix-control -step controls the stepsize between each selected waveform, skipping others. Interesting combination is to -control mix1 with the envelope (quant1 set to 2) -control mix2 with a bit-fast LFO (quant set to around 4) -control mix2 with a very slow LFO this creates a nice morphing over several timing intervals: -with each hit, it morphs following the envelope, allowing the strike to have a distinct other character then the tail -the fast LFO morph changes the characteristics of the sound during the tail, making it "wobble" -the slow LFO morph slowely changes the whole character of the sound over time
Author: Remco van der Most
License: BSD
Github: sss/osc/tablemorph2.axo

Inlets

int32 waveform

int32 step

frac32 mix1

frac32 mix2

frac32 mix3

frac32 env1

frac32 env2

frac32 env3

frac32 env4

frac32.bipolar pitch

frac32.bipolar pitch2

frac32.bipolar pitch3

frac32.bipolar pitch4

frac32buffer frequency

frac32buffer phase

frac32buffer sync

Outlets

int32 divide1

int32 divide2

int32 divide3

frac32buffer.bipolar wave

Parameters

frac32.s.map.pitch root

frac32.s.map.pitch LP

frac32.s.map detune

frac32.s.map intFM

frac32.s.map extFM

int32 hrm1

int32 hrm2

int32 hrm3

int32 hrm4

int32 waveform

int32 step1

int32 quant1

int32 step2

int32 quant2

int32 step3

int32 quant3

frac32.u.map mix1

frac32.u.map mix2

frac32.u.map mix3

Attributes

objref table

Declaration
uint32_t Phase[4];
int32_t mix[5];
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 Phs, int32_t preset1a, int32_t preset1b,
                 int32_t Mix, int32_t Preset2) {
  read1 = attr_table.array[(((Phs)&1023) + ((preset1a + Preset2) << 10)) &
                           attr_table.LENGTHMASK];
  read2 = attr_table.array[(((Phs)&1023) + ((preset1b + Preset2) << 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[4];
int32_t Freq[4];
int32_t phase[4];
Init
for (i = 0; i < 4; i++) {
  Phase[i] = 0;
}
Control Rate
int32_t intFM = param_intFM;
intFM = intFM > 0 ? intFM : -intFM;
intFM = ___SMMUL(intFM << 3, param_intFM << 2);
int16_t Preset = (param_waveform + inlet_waveform) & 1023;
int32_t f;
MTOF(param_LP, f)
MTOFEXTENDED(param_root + inlet_pitch1 + (param_detune >> 8), freq[0]);
MTOFEXTENDED(param_root + inlet_pitch2 + (param_detune >> 7), freq[1]);
MTOFEXTENDED(param_root + inlet_pitch3 + (param_detune >> 8) * 3, freq[2]);
MTOFEXTENDED(param_root + inlet_pitch4 + (param_detune >> 6), freq[3]);
freq[0] = freq[0] * param_hrm1;
freq[1] = freq[1] * param_hrm2;
freq[2] = freq[2] * param_hrm3;
freq[3] = freq[3] * param_hrm4;
MIX1 = param_mix1 + inlet_mix1;
MIX2 = param_mix2 + inlet_mix2;
MIX3 = param_mix3 + inlet_mix3;
MX(MIX1);
MIX1 = F;
MX(MIX2);
MIX2 = F;
MX(MIX3);
MIX3 = F;
P[0] = ((((MIX1 * param_quant1) >> 27) + 1) >> 1) << 1;
P[1] = (((MIX1 * param_quant1) >> 28) << 1) + 1;
MIX1 = (MIX1 - (((MIX1 * param_quant1) >> 28) << 28) / param_quant1) *
       param_quant1;
MIX1 = MIX1 > (1 << 27) ? ((2 << 27) - MIX1) : MIX1;
P[0] = P[0] * (param_step1 + inlet_step);
P[1] = P[1] * (param_step1 + inlet_step);

P[2] = ((((MIX2 * param_quant2) >> 27) + 1) >> 1) << 1;
P[3] = (((MIX2 * param_quant2) >> 28) << 1) + 1;
MIX2 = (MIX2 - (((MIX2 * param_quant2) >> 28) << 28) / param_quant2) *
       param_quant2;
MIX2 = MIX2 > (1 << 27) ? ((2 << 27) - MIX2) : MIX2;
P[2] = P[2] * (param_step2 + inlet_step);
P[3] = P[3] * (param_step2 + inlet_step);

P[4] = ((((MIX3 * param_quant3) >> 27) + 1) >> 1) << 1;
P[5] = (((MIX3 * param_quant3) >> 28) << 1) + 1;
MIX3 = (MIX3 - (((MIX3 * param_quant3) >> 28) << 28) / param_quant3) *
       param_quant3;
MIX3 = MIX3 > (1 << 27) ? ((2 << 27) - MIX3) : MIX3;
P[4] = P[4] * (param_step3 + inlet_step);
P[5] = P[5] * (param_step3 + inlet_step);

outlet_divide1 = param_quant1;
outlet_divide2 = param_quant2;
outlet_divide3 = param_quant3;
Audio Rate
if ((inlet_sync > 0) && !Strig) {
  for (i = 0; i < 4; i++) {
    Phase[i] = 0;
  }
  Strig = 1;
} else if (inlet_sync < 1) {
  Strig = 0;
}
int32_t sum;
for (i = 0; i < 4; i++) {
  Freq[i] = freq[i] + ___SMMUL((___SMMUL((mix[(i - 1) & 3]) << 3, intFM << 4) +
                                ___SMMUL(inlet_extFM << 3, param_extFM << 4))
                                   << 3,
                               freq[i] << 2);
  Phase[i] += Freq[i];
  phase[i] = (Phase[i] + (inlet_phase << 4)) >> 22;
}
tableOsc(0, phase[0], P[0], P[1], MIX1, P[2] + P[4] + Preset);
tableOsc(1, phase[1], P[0], P[1], MIX1, P[3] + P[4] + Preset);
tableOsc(2, phase[2], P[0], P[1], MIX1, P[2] + P[5] + Preset);
tableOsc(3, phase[3], P[0], P[1], MIX1, P[3] + P[5] + Preset);
mix[0] = ___SMMUL(mix[0] << 3, inlet_env1 << 2);
mix[1] = ___SMMUL(mix[1] << 3, inlet_env2 << 2);
mix[2] = ___SMMUL(mix[2] << 3, inlet_env3 << 2);
mix[3] = ___SMMUL(mix[3] << 3, inlet_env4 << 2);
tablemix(0, mix[0], mix[1], MIX2);
tablemix(1, mix[2], mix[3], MIX2);
tablemix(4, mix[0], mix[1], MIX3);
smooth = __SMMLA((mix[4] - smooth) << 1, f, smooth);
outlet_wave = smooth;

Privacy

© 2024 Zrna Research