Page 1 of 1

additive synthesis of a sawtooth wave

Posted: Mon Dec 12, 2016 2:01 pm
by Logado
Hi. I create the saw by the sum sine waves using the formula.
2.0f * sin(counter)
- sin(counter * 2.0f)
+ 2.0f / 3.0f * sin(3.0f * counter)
- 1.0f / 2.0f * sin(4.0f * counter)
+ 2.0f / 5.0f * sin(5.0f * counter)
- 1.0f / 3.0f * sin(6.0f * counter)
+ 2.0f / 7.0f * sin(7.0f * counter)
etc... formula here http://www.intmath.com/fourier-series/f ... applet.php
it's possible use only sum, create saw wave? dont use FFT and SUB?

Re: additive synthesis of a sawtooth wave

Posted: Mon Dec 12, 2016 3:52 pm
by Spogg
Hi Logado

You might possibly be interested in this topic...

viewtopic.php?f=3&t=3632&start=0&hilit=wavemaker

Cheers

Spogg

Re: additive synthesis of a sawtooth wave

Posted: Mon Dec 12, 2016 4:23 pm
by Logado
hi, thx for reply it's interesting but i want to visualize this.
Now I have it https://i.gyazo.com/9d93de83294cdd7ef65 ... eb767c.gif
but I want to use a very simple code to make it clearer.
I want to create something like tutorial on the synthesis and what is the difference from the analogue and digital

Re: additive synthesis of a sawtooth wave

Posted: Mon Dec 12, 2016 4:34 pm
by Spogg
That's a nice gif!

Maybe somone here knows of a good resource for such an ambition.

This is a nice demo of the principle

https://www.youtube.com/watch?v=K3D1fPjWAnc

Good luck and let us know how you get on :D

Cheers

Spogg

Re: additive synthesis of a sawtooth wave

Posted: Mon Dec 12, 2016 4:53 pm
by Logado
Yeah nice video. i want something similar but more complex. :D
I found solution
for (float i = 1; i < numHarmonics; i++)
{
wavey += cos(counter * i + phaseoffset) * 1.0f / i;
}
where
phaseoffset = -1 * 3.14159265357989323846 / 2.0f;