Play with Sines

This project was inspired by the following article Purrier Series
The purpose of this project is just to play with sines, from the article linking above, you can see that you can approximate periodic function with sums of sines. If you can't see the beautiful of the sine function, you are sinner my friend, it is thanks to this function that you can read this web page with your computer or smartphone. A trivial sines is composed from an amplitude and a frequency -also a phase, but I didn't feel like writing an extra code- below you can see graphically how multiple sines are added togheter, and if you put right fourier coefficient for a function, you can approximate it.
Actually, another coefficient was also needed, but we don't care, we want only play with sines.
With the properly coefficient we can obtain a lot of signal, signal that we use to communicate in the virtual world.

How to play

From the button rectangle wave and triangle wave, you get 15 coefficient for the relative function.
You can also insert custom coefficient, the amplitude is expressed in pixel and if the coefficient is too small, scale all coefficient multiplying for the same factor.
The n box is for the n-th coefficient and is a multiple of the fundamental frequency f0, don't worry for the value of this, it is irrelevant for the shape of the function.