Audio shield user manual - PlainDSP

2 downloads 160 Views 295KB Size Report
amplitude because we are representing the signal in the time domain. 128 ... We will get a signal which is the sum of bo
PlainDSP Audio Shield

7.1

Fourier Transform

Jean-Baptiste Joseph Fourier’s initial intuition was that it would be possible to decompose any periodic function into a sum of sines and cosines. This was not a new idea, as ancient astronomers (3rd century BC) suggested that an empiric model could be found as a description of planetary motions, based on deferent’s and epicycles. Fourier's idea was to model complicated heat sources as a linear combination of simple sine and cosine waves, and to write the solution as a superposition of the individual solutions. This superposition, or linear combination, is called the Fourier series. Getting any further in the theory of Fourier series would fill this book with boring content for most readers. However the Fourier series are extremely useful in digital signal processing. The aim of this chapter is to understand Fourier series through real life examples. 7.1.1

What is Fourier Transform about?

In the early chapters, we observed that the air pressure changes that are caused by sound can be traced as sines. Pressing the A4 key from a basic toy organ…

59

PlainDSP Audio Shield

Illustration 28

Will generate a 440 Hz signal like this:

Illustration 29

Note: The cross-reference between pitches and frequencies can be found in Table 23 form § 11.4 Recorded data points have been used to rebuild the signal, using the abscissa (X scale) as the time axis and the ordinates (Y scale) for the amplitude because we are representing the signal in the time domain. 128 60

PlainDSP Audio Shield

data points have been required and they are just enough to characterize the signal and give us a chance to evaluate its frequency and amplitude by measuring the x and y scale values. In comparison, next plot results from the application of a Fourier transform to the original sine signal.

Illustration 30

Computed data points have been used to rebuild the signal, using the abscissa (X scale) as the frequency axis and the ordinates (Y scale) for the amplitude because we are representing the signal in the frequency domain.

61

PlainDSP Audio Shield

Pressing the A5 key from the same toy organ

Illustration 31

Will generate a 880 Hz signal like this:

Illustration 32

62

PlainDSP Audio Shield

Leading to this type of frequency spectrum after running a Fourier transform

Illustration 33

If we now play both the previous keys together

Illustration 34

63

PlainDSP Audio Shield

We will get a signal which is the sum of both individual frequencies as per Illustration 29 and Illustration 32:

Illustration 35

Leading to this type of frequency spectrum after running a Fourier transform:

Illustration 36

64

PlainDSP Audio Shield

Question now. Based on the following plot, which keys were pressed on the keyboard to produce this signal?

Illustration 37

The frequency spectrum after running a Fourier transform gives:

Illustration 38

65

PlainDSP Audio Shield

Applying some extra math’s (See § 7.7) on this spectrum allows the plot of the frequency peaks along with their estimated apexes (estimated location of the peak top)

Illustration 39

Using this plot and the related estimates, we can clearly see that the original signal was made of three sine waves of equal amplitude with frequencies of 261.6 Hz, 329.6 Hz and 392.0 Hz corresponding to the C4, D4 and E4 pitches.

Illustration 40

66

PlainDSP Audio Shield

Note: You may have noticed that the scales have changed. This was necessary for getting enough resolution in order to clearly identify the individual frequencies. The sampling frequency was lowered from 10 kHz to 1 kHz so that the full scale of frequencies (Abscissa) drops from 5 kHz (half 10 kHz) to 500 Hz (half 1 kHz). The magic about Fourier transform is that the function is reversible back and forth from Time Domain to Frequency Domain and from Frequency Domain to Time Domain. This means that it is possible to reconstruct a real life signal from its frequency definition. We will get back to this property in the application section. 7.1.2

Fourier transform in more details

Fourier transform is applicable to vectors of data of any length. However, the time needed for computing what is called the discrete Fourier transform (DFT) would be extremely long because of the numerous basic operations to be executed. The idea of running a DFT as a faster way was raised pretty soon after Fourier’s works by mathematicians like Karl Friedrich Gauss but became effective in the mid-sixties because of the operability on modern computers. J.W. COOLEY and J.W. TUKEY are given credit for bringing the Fast Fourier Transform (FFT) to the world in their paper: "An algorithm for the machine calculation of complex Fourier Series," Mathematics 67