Fast Fourier Transform Lecture 6 Spoken Language Processing Prof. Andrew Rosenberg Overview • Fast Fourier Transform – Multiplying Polynomials – Relationship between polynomial multiplication and Fourier Analysis.

Download Report

Transcript Fast Fourier Transform Lecture 6 Spoken Language Processing Prof. Andrew Rosenberg Overview • Fast Fourier Transform – Multiplying Polynomials – Relationship between polynomial multiplication and Fourier Analysis.

Fast Fourier Transform
Lecture 6
Spoken Language Processing
Prof. Andrew Rosenberg
Overview
• Fast Fourier Transform
– Multiplying Polynomials
– Relationship between polynomial
multiplication and Fourier Analysis
1
Multiplying polynomials
• Assume two polynomials of degree d.
• The Fast Fourier Transform is an efficient
(divide-and-conquer) way to do this.
2
Multiplying polynomials
• Assume two polynomials of degree d.
Calculating ck takes Θ(d) steps.
To calculate C(x) requires Θ(d2)
3
Fast Fourier Transform
• How to multiply polynomials efficiently.
• What this has to do with frequency
decomposition.
4
Representing polynomials
• A d degree polynomial can be represented
by d+1 points.
– “any points determine a line”
Evaluation
Coefficients
Values
Interpolation
5
Multiplication algorithm
Input: coefficients of two polynomials A(x) and
B(x) and degree d
Output: Their product C = AB
Selection
Pick points x0, x1, xn-1 where n >= 2d+1
Evaluation
Compute A(x0), A(x1), ..., A(xn-1) and B(x0),
B(x1), ..., B(xn-1)
Multiplication
Compute C(xk) = A(xk)B(xk) for all k = 0,...,
n-1
Interpolation
Recover C(x) = c0 + c1x + ... + c2dx2d
6
Divide and Conquer for multiplication
• How can we pick the n points used in
evaluation?
– Can we pick them to make the algorithm more
efficient?
• If we choose positive and negative pairs,
the calculations overlap a lot.
7
Example representation as even powers
generally…
Where Ae are the even coefficients and Ao the odd.
Degree of Ae and Ao are <= d/2
8
Divide and Conquer multiplication
• Evaluating A(x) at n paired points can be
done by evaluating Ae(x) and Ao(x) at n/2
points.
• Recursively:
– T(n) = 2T(n/2) + O(n) = O(n log n)
9
Visualization
What’s the
problem with this
recursion?
Evaluate A(x)
x0
-x0
x 02
x1
-x1
x 12
… xn/2-1 -xn/2-1
…
xn/2-12
Evaluate Ae(x) and Ao(x)
10
Complex numbers
• After the top level of the recursion, none of
the points are negative – no paired points
anymore.
• Solution: Use complex numbers.
11
Complex roots of unity
• Assume the “bottom” of the recursion will
use +1.
• Identify the n points to start with.
+1
-1
+i
+1
-i
-1
+1
• nth roots are plus
minus paired
• squaring them give
the (n/2)th roots
12
Relationship between Complex Numbers
and Trig. functions
Euler’s Theorem
Discrete Fourier Transform
13
Interpolation
Evaluation
Coefficients
Values
Interpolation
• We built the FFT to evaluate.
• To Interpolate:
14
Fast Fourier Transform
function FFT(a, w)
--Input: an array a = (a0,a1,…,an-1) for n a power
of 2 and w, the inverse of a primitive nth root
of unity.
Output: coefficients
--if w = 1: return a
(s0,s1,sn/2-1) = FFT(a0,a2,…,an-2),w2)
(s’0,s’1,s’n/2-1) = FFT(a1,a3,…,an-1),w2)
for j = 0 to n/2 – 1:
rj = sj + wjs’j
rj+n/2 = sj - wjs’j
return r0,r1,…,rn-1
15
Frame Overlapping
• To construct a spectrogram, calculate the
“Discrete Fourier Transform” (using the
FFT) at overlapping frames.
10ms
10ms
10ms
10ms
10ms
16
Example Spectrogram
17
Single Frame of FFT
Australian male /i:/ from “heed” FFT analysis window 12.8ms
http://clas.mq.edu.au/acoustics/speech_spectra/fft_lpc_settings.html
18
Next Class
• Mel Frequency Cepstral Coefficients
• PLP/Rasta Features
• Reading: J&M 9.3
19