Additive synthesis of sine waves and sound generation

This program requires a web browser supporting HTML5 and Web Audio API. Internet Explorer does not support them. I recommend to use Firefox, Google Chrome, Opera, Safari

\[ y(t)=A\sum_{k=1}^{30} r_k \sin\left(2\pi k f t+\frac{\pi}{180}\phi_k\right) \]

$A=$ $f=$ Hz


What's this?

This program generates sound $y(t)$ by additive synthesis of sine waves. The window at top draws the generated wave during $1/f$ seconds ($t \in [0, 1/f]$). The sound will come from the speaker while pressing the play button.

There are presets: sine, triangle, square, and sawtooth. These waves also generated by at most thirty sine waves. Therefore, the square and sawtooth waves do not forms their perfect shapes because they have discontinuous points. However, the generated wave will not provide a feeling of strangeness.

J.S. Bach button plays the opening part of BWV645 by the specified tone.

Source code