Lode's Computer Graphics Tutorial Fourier Transform
has a DC component! The further away from the origin to the left or right a peak is, the higher thefrequency it represents, so a peak far to the right (and left) means that the signal contains a highfrequency component. Note that an audio signal never has a DC component, since nobody can produceor hear it. Electrical signals can have it however.Now let's look at a signal which is the sum of two sine functions: the second sine function has thedouble frequency of the first, so the curve has the shape sin(x)+sin(2*x):Since there are now two sines with two different frequencies, we can expect two peaks on the positiveside of the spectrum (and two more on the negative side since it's the mirrored version):If the two sines both have a different phase (i.e. one of the two sines is shifted horizontally), theamplitude of the spectum will still be the same, only the phase will be different, but the phase isn'tshown here.Arbitrary sound signals, such as a spoken word, consist of an infinite sum (or integral) of infinitelymuch sine functions, all with a different frequency, and all with their own amplitude and phase, and thespectrum is the perfect plot to view how much of each frequency is in the signal. Such a spectrumwon't just have a few peaks, but will be a continuous function.There are a few special functions with a special spectrum:The Dirac impuls is a signal that is zero everywhere, except at the origin, where it's infinite. That is theideal version for continuous functions, for a discrete function on a computer it can as well berepresented as a single peak with finite height at the origin.Such a peak sounds like a popping sound in an audio signal, and contains ALL frequencies. That's whyit's spectrum looks like this (the horizontal black line):
The spectrum is positive everywhere, so every frequency is contained in the signal. This also meansthat, to get such a peak as a sum of sine functions, you have to add infinitely much elementary sinefunctions all with the same amplitude, and all shifted with a certain phase, they'll cancel each other out,except at the origin, hence the peak.Note that it's possible to intepret the spectrum as a time signal (a constant DC signal), and that then thered function can be seen as it's spectrum (a peak at zero, since a DC signal has frequency 0). Thisduality is one of the interesting properties of the Fourier Transform as we'll see later.Finally, another special signal is the sinc(x) function; sinc(x) = sin(x)/x:It's spectrum is a rectangular pulse (here only an approximation of it because the spectrum wascalculated using only 128 points):Again because of the duality between a signal and it's spectrum, a rectangular time signal will have asinc function as it's spectrum.Spectra are also used to study the color of light. These are exactly the same thing, since light too is a 1-dimensional signal containing different frequencies, some of which the eye happens to be sensitive to.The spectrum shows for every frequency, how much of it is in the light, just the same as the audiospectrum does for audio signals.An MP3 player like Winamp also shows the spectrum of the audio signal it's playing (but it varies withtime because they calculate the spectrum each time again for the last few milliseconds), and spectra ofaudio signals can be used to detect bass, treble and vocals in music, for speach recognition, audiofilters, etc... Since this is a tutorial about computer graphics, I won't go any deeper in this however.Often, the spectrum is drawn on a logarithmical scale instead of a linear one like here, then theamplitude is expressed in decibels (dB).