think of a sawtooth made out of sine waves up to a given number
subtract a naive sawtooth out of this and you see the curve i'm talking about..
bl_saw(phase,H) - saw(phase)
// H is the number of harmonics (>= 1)
// note: the output of the bl_saw is divided by (pi/2)
now, adding sine waves is not cheap, especially when you must put lots of harmonics (on lower notes)
i know there are antialiasing/bandlimited techniques already, but let's not talk about these right now..
if this curve can be approximated easily like so approx(phase,H) where H is the number of harmonics - then this could be added to a naive sawtooth (or square) and you get a bandlimited waveform!
here's some plots:
the actual difference curve at different values of H
my best approx so far, as you can see, it's wrong in the first and last part
Code: Select all
h = floor(h); if (h <= 0.0) { h = 0.0; }
h = 1.0 + h + h;
x = -1.0 * ((cos(x*pi*h)) / (2.0+pi*h*sin(x*pi)) * 2.0);
i'm fairly not good at maths, so i turn to you, any ideas?