Audiable alias free waveform gen using width sine

Type : Very simple
References : Posted by joakim[DOT]dahlstrom[AT]ongame[DOT]com
Notes :
Warning, my english abilities is terribly limited.

How ever, the other day when finally understanding what bandlimited wave creation is (i am a noobie, been doing DSP stuf on and off for a half/year) it hit me i can implement one little part in my synths. It's all about the freq (that i knew), very simple you can reduce alias (the alias that you can hear that is) extremely by keeping track of your frequence, the way i solved it is using a factor, afact = 1 - sin(f*2PI). This means you can do audiable alias free synthesis without very complex algorithms or very huge tables, even though the sound becomes kind of low-filtered.
Propably something like this is mentioned b4, but incase it hasn't this is worth looking up

The psuedo code describes it more.

// Druttis

Code :
f := freq factor, 0 - 0.5 (0 to half samplingrate)

afact(f) = 1 - sin(f*2PI)

t := time (0 to ...)
ph := phase shift (0 to 1)
fm := freq mod (0 to 1)

sine(t,f,ph,fm) = sin((t*f+ph)*2PI + 0.5PI*fm*afact(f))

fb := feedback (0 to 1) (1 max saw)

saw(t,f,ph,fm,fb) = sine(t,f,ph,fb*sine(t-1,f,ph,fm))

pm := pulse mod (0 to 1) (1 max pulse)
pw := pulse width (0 to 1) (1 square)

pulse(t,f,ph,fm,fb,pm,pw) = saw(t,f,ph,fm,fb) - (t,f,ph+0.5*pw,fm,fb) * pm

I am not completely sure about fm for saw & pulse since i cant test that atm. but it should work :) otherwise just make sure fm are 0 for saw & pulse.

As you can see the saw & pulse wave are very variable.

// Druttis

Comments
from : druttis[AT]darkface[DOT]pp[DOT]se
comment : Um, reading it I can see a big flaw... afact(f) = 1 - sin(f*2PI) is not correct! should be afact(f) = 1 - sqrt(f * 2 / sr) where sr := samplingrate f should be exceed half sr

from : laurent[AT]ohmforce[DOT]com
comment : f has already be divided by sr, right ? So it should become : afact (f) = 1 - sqrt (f * 2) And i see a typo (saw forgotten in the second expression) : pulse(t,f,ph,fm,fb,pm,pw) = saw(t,f,ph,fm,fb) - saw(t,f,ph+0.5*pw,fm,fb) * pm However I haven't checked the formula.

from : 909[AT]gmx[DOT]de
comment : Hi Lauent, I'm new to that DSP stuff and can't get the key to what'S the meaning of afact? - Can you explain please!? - Thanks in advice!

from : druttis[AT]chello[DOT]se
comment : I've been playing around with this for some time. Expect a major update in a while, as soon as I know how to describe it :)

from : druttis[AT]chello[DOT]se
comment : afact is used as an amplitude factor for fm or fb depending on the carrier frequency. The higher frequency the lower afact. It's not completely resolving the problem with aliasing but it is a cheap way that dramatically reduces it.