multiLFO

LFO with 6 different waveform outputs. Each waveform can run at it's own harmonic rate (x1, x2, x3 etc) based on the root frequency. When "frqIn" is high, it reads the pitch-input as frequency (eg. for host-tempo-sync with BPMext module) and the pitch-knob is not used (octave and harmonics are still used!).
Author: Remco van der Most
License: BSD
Github: sss/lfo/multiLFO.axo

Inlets

frac32.bipolar pitch (freq when "frqIn" is high)

frac32 fm input

frac32 phase

bool32.rising reset phase

Outlets

frac32.bipolar sine wave

frac32 tri

frac32 saw

frac32 rmp

frac32 sqr

frac32 pls

Parameters

int32 sets octave respective to root frequency

int32 harmonic number for sine

int32 harmonic number for triangle

int32 harmonic number for saw

int32 harmonic number for ramp

int32 harmonic number for square

int32 hrmPls

frac32.s.map PW

frac32.s.map.lfopitch pitch control if "frqIn" is low, otherwise not used

bool32.tgl when high, uses "pitch" input as a frequency instead of semitone input (eg. connect BPMext's "baserate" output to "pitch" input)

Declaration
int32_t Phase;
uint32_t r;
int32_t v30 = 1 << 30;
uint32_t v31 = 1 << 31;
int32_t v27 = 1 << 27;
Init
Phase = 0;
r = 1;
Control Rate
if (inlet_reset && r) {
  Phase = inlet_phase << 4;
  r = 0;
} else {
  if (!inlet_reset)
    r = 1;
}

int32_t freq;
MTOFEXTENDED(param_pitch + inlet_pitch, freq);
if (param_frqIn > 0) {
  freq = inlet_pitch;
}
freq = param_octave > 0 ? freq << param_octave : freq >> -param_octave;
freq = freq >> 2;
freq += ___SMMUL(freq, inlet_freq << 4) << 2;
Phase += freq;
int32_t sine;
SINE2TINTERP(Phase *param_hrmSin, sine)
outlet_sine = (sine >> 4);
int32_t tri = Phase * param_hrmTri;
outlet_tri = (tri > 0 ? tri : -tri) - v30 >> 3;
int32_t saw = (Phase - v30);
saw = saw * param_hrmSaw;
outlet_saw = saw >> 4;
int32_t rmp = (-Phase + v30);
rmp = rmp * param_hrmRmp;
outlet_rmp = rmp >> 4;
int32_t sqr = -Phase - v30;
sqr = sqr * param_hrmSqr;
outlet_sqr = sqr > 0 ? -v27 : v27;
uint32_t Sqr = Phase + v30;
Sqr = Sqr * param_hrmPls;
Sqr = Sqr >> 4;
outlet_pls = Sqr < param_PW + v27 ? -v27 : v27;

Privacy

© 2024 Zrna Research