Sorry, you need a Java-enabled browser to see the simulation. I'm not aware of a Java browser for Mac or Windows 3.11, but if you're running UNIX or 32-bit Windows, the latest version of Netscape will support Java.

1D Fourier Transformation Java Applet

Description:
This java applet is a simulation that demonstrates Fourier series, which is a method of expressing an arbitrary periodic function as a sum of sine+cosine or just cosine terms. In other words, Fourier series can be used to express a function in terms of the frequencies (harmonics) it is composed of.

1D Function: To select a function, you may press one of the following buttons: Sine, Triangle, Sawtooth, Square, and Noise. The function is displayed in white, with the Fourier series approximation in red. If you only see a red graph, that means the Fourier approximation is nearly the same as the original function. (The red graph is drawn on top of the white one.)

1D FT: Below the function you will see a graph of the Fourier coefficients. Each one represents a frequency, or harmonic. There are two sets of terms; on top are the magnitude terms, and on the bottom are the phase terms. Low frequencies are on the left and higher frequencies are on the right. (If you're only familiar with Fourier series expansions that involve sines and cosines, rather than phases, check out this page.)

FT Function Approximation: The Number of Terms slider will adjust the number of terms in the Fourier expansion. The more terms there are, the better the approximation. Try sliding the Number of Terms slider from left to right slowly to see the Fourier terms added up one by one.

Adjusting the Signal (in Time/Frequency Domain): If you move the mouse over one of the harmonics, it will turn yellow, and the corresponding Fourier term (frequency) will be drawn on top of the function in yellow. So if you move the mouse over all the harmonics, you can see each of the terms individually. Also, if you click with the right mouse button on one of the harmonics, the Number of Terms slider will be changed so that all higher-frequency terms will be taken out of the series. You can modify the function in one of two ways. You can edit the function directly by clicking on it; in this case, the Fourier coefficients will be regenerated when you are done. Or, you can modify the Fourier coefficients, in which case the function will be changed to match. If you want to create a function from scratch, hit the Clear button.

Sounds: The Play button will play the function at 220 Hz. The frequency is adjustable using the Playing Frequency slider. Try playing various functions to see what they sound like. Also try isolating each harmonic, or mixing two or three harmonics together. The Number of Terms slider will affect how many harmonics are played. (The sampling rate used for playing is 22 KHz, so frequencies higher than 11,000 Hz will be flitered out.)

Signal Amplitude: The Clip button can be used to simulate clipping. It will increase the amplitude of the function, but will clip it if it goes out of range. Try doing this with a sine function. Using this button generally results in more jagged edges, which means more high-frequency terms will be involved in the expansion. Some functions, like the square wave, aren't affected much by clipping. Try playing the noise waveform and then hit "Clip" a few times to see if it changes.

Aliasing: The Resample button can be used to demonstrate aliasing. This is one of the effects which causes the Play button to produce such poor results. The function is replaced with samples at 12 points. This corresponds to a sampling frequency of 2,640 Hz (at the default playing frequency of 220 Hz). In almost all cases this will cause aliasing, where new, unwanted frequencies will be introduced. For frequencies over 1,320 Hz, the aliases will be stronger than the original frequency. For example a frequency of 440 Hz, when resampled, will have aliases at 2200 Hz (2640-440), 3080 Hz (2640+440), 4840 Hz (2640*2-440), 5720 Hz (2640*2+440), and so on.

Quantization Distortion: When the Quantize button is pressed, the values in the function are rounded off to the nearest multiple of 1/2. The resulting roundoff error causes new frequencies to be introduced; these can be heard when the function is played. This is called quantization distortion.

Positive Signals: The Rectify button will zero out the function wherever it is negative. The Full Rectify button will take the absolute value of the function at all points. Try this with the sine or sawtooth function.

Other things to try:

• Draw a rapidly varying sine wave (as best you can), and check out the Fourier coefficients to see if the frequency is picked up by the Fourier decomposition. One of the magnitudes should be much higher than the others.
• Start with a function, and remove Fourier terms one by one by setting the coefficients to zero.
• Start with a sine wave, and then hit the Clip button repeatedly. Watch how higher-frequency terms become more and more prominent.
• Hit Clear and then add two frequencies to the function by clicking on the magnitudes. See how the frequencies interact. If the frequencies are fairly close together, you should see beats; the amplitude of the overall function will oscillate at a frequency which is equal to the difference in the original two frequencies.

The source.
This applet was developed by Paul Falsta:  java@falstad.com