supertrisaw

super triangle/saw-morpher up to 8 voices
Author: Remco van der Most
License: BSD
Github: sss/osc/supertrisaw.axo

Inlets

frac32.positive slope

bool32 active

frac32 pitch

frac32.bipolar FMW

frac32buffer freq

frac32buffer phase

Outlets

frac32buffer out

Parameters

frac32.s.map FM

frac32.s.map detune

frac32.u.map slope

int32 voices

frac32.s.map.pitch pitch

Declaration
uint32_t phase[8];
uint32_t Phase[8];
float32_t slope1n[8];
uint64_t slope1d[8];
uint64_t slope1e[8];
int32_t out[8];
int32_t Slope;
int32_t Fmw;
int32_t FMW;
int i;
int32_t freq;
int32_t fmw;
int32_t slape;
Control Rate
if (inlet_active > 0) {

  MTOF(param_pitch + inlet_pitch, freq)
  slape = __SSAT(param_slope + inlet_slope, 28);
  fmw = __SSAT(param_FM + inlet_FMW, 29);
}
Audio Rate
if (inlet_active > 0) {
  int32_t sum = 0;
  Slope = Slope + ((slape - Slope) >> 6);
  Fmw = Fmw + ((fmw - Fmw) >> 6);
  FMW = ___SMMUL(inlet_freq << 4, (Fmw) << 2);

  for (i = 0; i < param_voices; i++) {
    phase[i] += freq * (1 + i) + ___SMMUL(FMW << 4, (freq * (1 + i)) << 4) +
                i * (param_detune >> 6);
    Phase[i] = phase[i] + (inlet_phase << 5);
    slope1d[i] = (1 << 27) - Slope;
    if (Phase[i] < (Slope << 5)) {
      slope1n[i] = ((float)((1 << 31))) / ((float)(Slope));
      out[i] = ((Phase[i] >> 5) * slope1n[i]) + (1 << 30);
    } else {
      slope1n[i] = ((float)((1 << 31))) / ((float)(slope1d[i]));
      out[i] = -(((Phase[i] - (Slope << 5)) >> 5) * slope1n[i]) - (1 << 30);
    }
    sum += (out[i] >> 4) / (1 + i / 2);
  }
  outlet_out = sum >> 1;
} else {
  outlet_out = 0;
}

Privacy

© 2024 Zrna Research