I recently posted anti-aliased versions of the basic oscillators in the
chuck forums. They're based on integrating the oscillator's function
over phase changes to get the average value over one sample.
Here's an example of an anti-aliased saw wave taking the current phase
and the difference to the next phase as arguments:
fun float fun_aa_saw(float t,float delta_t) {
t-Math.floor(t+0.5) => float t1;
t+delta_t-Math.floor(t+delta_t+0.5) => float t2;
return (t2*t2-t1*t1)/Std.fabs(delta_t);
}
They're quite heavy on the CPU because they need to ticked every
sample in ChucK so it would be nice to imlement them on the source
level.
We do have the Blit versions of the oscillators but they only
reproduce the sound of the osc they're band-limiting. Average-anti-
alias keep the waveform more intact while still considerably reducing
frequency leaking.
How do I design oscillators on the source level of ChucK?
Yours,
Pyry Pakkanen