hrmOsc

sort of harmonics-selecting oscillator or something -quant sets the amount of harmonics used in a single phase-cycle, in powers of 2 (so, 2,4,8,16,32,64) -offset gives an offset to all harmonic values, selecting a different set of harmonics in a single cycle -step sets the stepsize for selecting harmonic values -range sets the range for the highest harmonic that may be used
Author: Remco van der most
License: BSD
Github: sss/osc/hrmOsc.axo

Inlets

frac32 pitch

frac32buffer phase increment

Outlets

frac32buffer.positive phasor wave

Parameters

frac32.s.map.pitch pitch

frac32.s.map fm

int32 quant

int32 offset

int32 step

int32 range

Declaration
uint32_t Phase;
uint64_t P1;
uint64_t P2;
int32_t S1;
int32_t S2;
Init
Phase = 0;
Control Rate
uint32_t freq;
MTOFEXTENDED(param_pitch + inlet_pitch, freq);
Audio Rate
Phase += (freq >> 0) +
         ___SMMUL(___SMMUL(inlet_freq << 4, param_fm << 4) << 3, freq << 2);
P1 = Phase;
P1 = (P1 / ((1 << 30) >> (param_quant))) >> 2;
P2 = ((Phase - ((P1 << 2) * ((1 << 30) >> (param_quant))) << param_quant)) >> 1;
SINE2TINTERP(P2 - (1 << 30), P2)
P2 = (P2 >> 5) + (1 << 26);
int p1 = P1;
int p2 = 1 + P1;
p2 = p2 - ((p2 >> (param_quant)) << (param_quant));
p1 = (p1 + param_offset) * param_step;
p2 = (p2 + param_offset) * param_step;
p1 = p1 - ((p1 / param_range) * param_range);
p2 = p2 - ((p2 / param_range) * param_range);
SINE2TINTERP(Phase *(1 + p1), S1)
SINE2TINTERP(Phase *(1 + p2), S2)
outlet_phasor = ___SMMUL(S1, ((1 << 27) - P2)) + ___SMMUL(S2, P2);

Privacy

© 2024 Zrna Research