goertzel algorithm n.
Skip this Video
Loading SlideShow in 5 Seconds..
“Goertzel Algorithm" PowerPoint Presentation
Download Presentation
“Goertzel Algorithm"

“Goertzel Algorithm"

816 Views Download Presentation
Download Presentation

“Goertzel Algorithm"

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. “Goertzel Algorithm" Texas Instruments University Programme Teaching Materials

  2. Goertzel Algorithm

  3. Introduction • Touch tone telephones use Dual Tone Multi Frequency (DTMF) for dialling numbers • When a keyboard button on a telephone is pressed, pairs of audio tones are generated • The receiver listens to the audio tones and decodes them using the Goertzel Algorithm.

  4. Objectives • To implement Goertzel algorithm in C code • To use the Goertzel Algorithm to decode the tones generated by a touch-tone telephone • To display the key pressed on the console of Code Composer Studio.

  5. Touch Tone Telephone

  6. Touch Tone Telephone A touch tone telephone works using audio. A pair of audio tones is generated for every key push. Click on the icon to hear the tones.

  7. How the Receiver Works The receiver listens to the audio notes. Analogy: you press a key on the piano. Someone with “perfect pitch” listens and says “you played the note C”.

  8. Keypad Frequencies 1336 Hz 1209 Hz 1477 Hz 697 Hz 770 Hz 852 Hz 941 Hz

  9. DTMF = Row + Column

  10. Characteristics of Dual Tones • No frequency is a multiple (harmonic) of another • The sum of any two frequencies does not equal any of the other frequencies • The difference between any two frequencies does not equal any of the other frequencies. • The frequency must be within 2% of that specified for the receiver to accept it.

  11. Choice of Frequencies • The tones must not be confused with musical frequencies: • Musical frequencies such as 440 Hz, 523 Hz etc are not used. • Speech can contain second order harmonics: • Ideally the detector should ignore a tone with a high second-order content.

  12. The Goertzel Algorithm

  13. All-Pole IIR Filters • An individual frequency can be identified using an IIR filter with poles placed on the unit circle.

  14. Calculating Filter Values • The formula for the 2nd Order band pass IIR filter is: • Here f = frequency of tone and fs = 8000 Hz.

  15. Filter Difference Equations • The difference equations for this IIR filter are: • Here: x(n) = filter input v(n) = filter output N = number of times filter is applied.

  16. Matlab Model of Band Pass Filter

  17. Filter Output and Poles/Zeros

  18. Power In Signal • The outputs from IIR filters have: • amplitude • phase shift • This means the filter outputs will have both real and imaginary components • To calculate the power in the signal we have: • Power = real2 x imaginary2 • In this case we can ignore the phase shift.

  19. Calculating the Power • The power in the signal is calculated as follows: Where: N = total number of times filter is used, typically 210 v(N) = filter output after N times v(N-1) = previous filter output. • A detailed description is to be found in Ifeachor and Jervis in the References section.

  20. Goertzel Algorithm Implementation Requires 8 IIR filters, one for each frequency. Run each filter for the input signal x(n) a total of (typically) 205 to 210 times. The final time through, calculate the power in each of the 8 frequencies. Evaluate which pairs of tones are present from the 8 calculated powers.

  21. Twist • Ideally the two individual DTMF frequencies should have the same amplitude. • This is not always the case. • The ratio between the two individual tones is referred to as “twist”. • Tones where there is a large amount of “twist” may not be DTMF signals.

  22. C Code Implementation

  23. C Code Implementation The Goertzel Algorithm can be implemented using a sampling frequency of 8000 Hz Each sample takes 210 / 8 = 26.25 ms The output can be built using a sample-by-sample basis Calculation is updated on the arrival of every new input value.

  24. C Code for Filters

  25. C Code for Power

  26. Introduction to Laboratory

  27. Practical Goertzel Algorithm In this laboratory the keyboard button pushes will be identified by listening to the audio The first part is to test the filter frequencies using a signal generator The second part is to place the microphone near the telephone keyboard and press a keyboard button The button pressed will be displayed on the console.

  28. Installing the Application Copy the files from Application 15 Goertzel Algorithm to the workspace Follow the steps previously given in Chapter 1 to set up the new project.

  29. Create New CCS Project

  30. Files Used

  31. USB Stick Setup for Test USB to PC Signal Generator Headphones

  32. Testing the IIR Filters Before testing with a telephone keypad, it is useful to test the accuracy of each IIR filter. The version using main1.c contains only single IIR filters. It is possible to test the filters using a signal generator.

  33. Console View: Test Version main1.c

  34. USB Stick Setup for Application USB to PC Microphone Headphones

  35. Console View: Application main.c

  36. Testing the Application

  37. Typical Output

  38. Alternate Test Setup • This requires two TMS320C5505 USB Sticks to be available • Use DTMF generator from Application 14 DTMF Generator to generate the tones • Another option is to record the DTMF tones to a .wav file and then play this back to the TMS320C5505 USB Stick.

  39. Experiments

  40. Identifying a Telephone Number The implementation in C code only identifies single button pushes. Write your own version of main.c which can identify an entire telephone number.

  41. Second Harmonics • Add a second series of IIR filters for 2x each of the frequencies. • For example, for 697 Hz, add a second filter at 1394 Hz. • Ignore signals where a large amount of second harmonic is present.

  42. Twist • Add code to only accept DTMF tones only if the ratio of frequency1 : frequency2 is less than 2:1. • This prevents non-DTMF tones being accepted.

  43. Question What sort of filters does the Goertzel Algorithm use? Why does the Goertzel Algorithm calculate the output power? How can music be distinguished from DTMF tones?

  44. References • Digital Signal Processing, A Practical Approach by Emmanuel C. Ifeachor and Barrie W. Jervis. ISBN 0201-59619-9.