You are on page 1of 18

Applications Of

Goertzel Algorithm
Presented by
Wattamwar Reshma R.
Roll No:13
ME-FY(Digital system)

What is Goertzel algorithm?


The Goertzel algorithm is a Digital Signal
Processing technique that provides a means for
efficient evaluation of individual terms of the
Discrete Fourier Transform.

A basic Goertzel
Before you can do the actual Goertzel, you must
do some preliminary calculations:
1. Decide on the sampling rate.
2. Choose the block size, N.
3. Precompute one cosine and one sine term.
4. Precompute one coefficient.

Sampling rate:

The number of samples carried per second is


called sample rate.
Your sampling rate may already be determined
by the application. For example, in telecom
applications, it's common to use a sampling rate
of 8kHz (8,000 samples per second).

Block size:
Goertzel block size N is like the number of points
in an equivalent FFT. It controls the frequency
resolution (also called bin width).
For example, if your sampling rate is 8kHz and N
is 100 samples, then your bin width is 80Hz.

Precomputed constants
f tone
k N
fs

per-sample processing
calculate Q0, Q1, and Q2.
Q0 = coeff * Q1 - Q2 + sample
Q2 = Q1
Q1 = Q0
After running the per-sample equations N times,
it's time to see if the tone is present or not.

Magnitude calculation:
real = (Q1 - Q2 * cosine)
imag = (Q2 * sine)
(Magnitude)2 = (real)2+(imag)2

An optimized Goertzel
The optimized Goertzel requires less
computation than the basic one, at the expense
of phase information.
The per-sample processing is the same, but the
end of block processing is different. Instead of
computing real and imaginary components, and
then converting those into relative magnitude
squared, you directly compute the following:
(Magnitude)2=(Q1)2+(Q2)2-Q1*Q2*coeff

Implementation
(1) The first stage calculates an intermediate sequence
S(n).

(2) The second stage applies the following filter to S(n),


producing output sequence Y(n).

Implementation
The Z transform of the first filter stage given in equation

The Z transform of the second filter stage given in equation

The combined transfer function of the cascade of the two filter stages
is then

Applications

Dual Tone Multi-Frequency (DTMF) applications.

Push-button digital telephone sets.


electronic mail and telephone banking systems.
Tuning of guitar string.
Detection of specific frequencies in audio signals.

DTMF Signaling
In a DTMF signaling system a combination of
two frequency tones represents a specific digit,
character (A, B, C or D) or symbol (* or #).
Two types of signal processing are involved:
Coding or generation.
Decoding or detection.
For coding, two sinusoidal sequences of finite
length are added in order to represent a digit,
character or symbol as shown in the following
example.

DTMF Tone Generation


1209Hz 1336Hz 1477Hz 1633Hz

770Hz

852Hz

941Hz

Output

697Hz

770

1336

Freq (Hz)

Example: Button 5 results in a 770Hz and a


1336Hz tone being generated simultaneously.

Frequency

697
770
852
941
1209
1336
1477
1633

18
20
22
24
31
34
38
42

Coefficient
(decimal)
1.703275
1.635585
1.562297
1.482867
1.163138
1.008835
0.790074
0.559454

Coefficient
(Q15)
0x6D02*
0x68B1*
0x63FC*
0x5EE7*
0x4A70*
0x4090*
0x6521
0x479C

N = 205 fs = 8kHz The decimal values are divided by 2 to be represented in


Q15 format. This has to be taken into account during implementation

DTMF Tone Detection


Detection of tones can be achieved by using a
bank of filters or using the Discrete Fourier
Transform (DFT or FFT).
However, the Goertzel algorithm is more efficient
for this application.
The Goertzel algorithm is derived from the DFT
and exploits the periodicity of the phase factor,
exp(-j*2k/N) to reduce the computational
complexity associated with the DFT, as the FFT
does.

With the Goertzel algorithm only 16 samples of


the DFT are required for the 16 tones

Advantage
Simple structure of algorithm makes it well
suited to small processors.
More efficient than FFT for small number of
frequencies ( if M < log2N).

THANK YOU!