pulsine2

modded waveform oscillator able to make saw, sine and pulse waveforms using the "gain" parameters -"gain1" controls the phase width going into the sine shaper, saturated. -"extend" enables the gain to go lower, enabling saw->sine->pulse morphing instead of only sine->pulse. -"gain2" controls the width of the sine going into a saturator. the pitch output outputs the combined pitch information (parameter+input+FM-signal), this can be used together with the "mostfilter" module to filter the waveform while keeping track of the modulated pitch in real time. -the result goes through a highpass filter to remove DC-offset
Author: Remco van der Most
License: BSD
Github: sss/osc/pulsine2.axo

Inlets

frac32buffer frequency

frac32buffer phase

frac32.bipolar pitch

frac32 fmw

frac32 gain1

frac32 gain2

frac32 hp

frac32 volume

Outlets

frac32buffer pitch

frac32buffer.bipolar sine wave

Parameters

bool32.tgl extend

frac32.s.map.pitch pitch

frac32.s.map fmw

frac32.s.map phase

frac32.u.map gain1

frac32.u.map gain2

frac32.u.map hp

frac32.u.map volume

Declaration
uint32_t Phase;
int32_t sig;
int32_t hp;
int32_t HP;
Init
Phase = 0;
hp = 0;
Control Rate
int32_t gain1 = param_gain1 + inlet_gain1 + (4 << 21);
if (param_extend > 0) {
  gain1 += (4 << 21);
}
int32_t gain2 = param_gain2 + inlet_gain2 + (4 << 21);
int32_t fmw = inlet_fmw + param_fmw;
Audio Rate
int32_t mod = ___SMMUL(inlet_freq << 3, fmw << 3);
int32_t freq;
MTOFEXTENDED(param_pitch + inlet_pitch + mod, freq);
int32_t HP;
MTOF((param_hp << 1) + param_pitch + inlet_pitch + inlet_hp + mod - (1 << 26),
     HP);

Phase += freq;
int32_t r;
int32_t p2 = Phase + (inlet_phase << 4);
SINE2TINTERP((__SSAT(___SMMUL(gain1 << 4, p2), 28) << 4) + (param_phase << 1),
             r)
sig = __SSAT(___SMMUL(gain2 << 4, r), 27);
hp = ___SMMLA((sig - hp) << 1, HP, hp);
outlet_wave = ___SMMUL((sig - hp) << 3, (param_volume + inlet_volume) << 2);
outlet_pitch = param_pitch + inlet_pitch + mod;

Privacy

© 2024 Zrna Research