sawtrimod

saw<->tri mod oscillator
Author: Remco van der Most
License: BSD
Github: sss/osc/sawtrimod.axo

Inlets

frac32buffer input

frac32 saw<-tri->ramp

frac32 Half part Rate

frac32 saw<-tri->ramp

frac32 Half part Rate

frac32 upper harmonic add

frac32 Sine Curve

Outlets

frac32buffer output

Audio Rate
int32_t phases;
int32_t phaset;
int32_t phaseu;
int32_t phasev;
int32_t phasew;
int32_t phasex;
int32_t phasey;
int32_t phasez;
int32_t sina;
int32_t sinb;
int32_t mixa;
int32_t mixb;
int32_t mixc;
int32_t mixd;
int32_t wa;
int32_t wb;
int32_t wc;
int32_t we;
int32_t wf;
int32_t phaseg1;
int32_t phaseg2;
int32_t phaseg3;
int32_t phaseg4;

wa = inlet_a;
wb = (inlet_b >> 1) + (1 << 26);
wc = (1 << 27) - wb;

if (wa < wb) {
  phaseu = wa * ((1 << 30) / wb) >> 3;
} else {
  phaseu = (1 << 27) - ((wa - wb) * ((1 << 30) / wc) >> 3);
}

phasev = (phaseu + (wa > wb ? (___SMMUL(inlet_c << 3, (wa - wb) << 4)) : 0));
phaset = (phasev > 0 ? phasev : -phasev) & ((1 << 27) - 1);

SINE2TINTERP((phaset << 4) - (1 << 30), sina)
mixa = (sina >> 5) + (1 << 26);
mixb = (1 << 27) - inlet_f;
phasew = ___SMMUL(inlet_f << 3, phaset << 2) + ___SMMUL(mixb << 3, mixa << 2);

we = (inlet_d >> 1) + (1 << 26);
wf = (1 << 27) - we;

if (phasew < we) {
  phasex = phasew * ((1 << 30) / we) >> 3;
} else {
  phasex = (1 << 27) - ((phasew - we) * ((1 << 30) / wf) >> 3);
}

phasey =
    (phasex + (phasew > we ? (___SMMUL(inlet_e << 3, (phasew - we) << 4)) : 0));
phases = (phasey > 0 ? phasey : -phasey) & ((1 << 27) - 1);

SINE2TINTERP((phases << 4) - (1 << 30), sinb)
mixc = (sinb >> 5) + (1 << 26);
mixd = (1 << 27) - inlet_g;
phasez = ___SMMUL(inlet_g << 3, phases << 2) + ___SMMUL(mixd << 3, mixc << 2);
phaseg3 = phasez & ((1 << 28) - 1);
phaseg1 = phaseg3 < 0 ? -phaseg3 : phaseg3;
phaseg2 = phaseg1 > (1 << 27) ? (1 << 28) - phaseg1 : phaseg1;
outlet_result = phaseg2 - (1 << 26);

Privacy

© 2024 Zrna Research