200 likes | 459 Vues
Fast Fourier Transform. Lecture 6 Spoken Language Processing Prof. Andrew Rosenberg. Overview. Fast Fourier Transform Multiplying Polynomials Relationship between polynomial multiplication and Fourier Analysis. Multiplying polynomials. Assume two polynomials of degree d .
E N D
Fast Fourier Transform Lecture 6 Spoken Language Processing Prof. Andrew Rosenberg
Overview • Fast Fourier Transform • Multiplying Polynomials • Relationship between polynomial multiplication and Fourier Analysis
Multiplying polynomials • Assume two polynomials of degree d. • The Fast Fourier Transform is an efficient (divide-and-conquer) way to do this.
Multiplying polynomials • Assume two polynomials of degree d. Calculating ck takes Θ(d) steps. To calculate C(x) requires Θ(d2)
Fast Fourier Transform • How to multiply polynomials efficiently. • What this has to do with frequency decomposition.
Representing polynomials • A d degree polynomial can be represented by d+1 points. • “any points determine a line” Evaluation Coefficients Values Interpolation
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
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.
Example representation as even powers generally… Where Ae are the even coefficients and Ao the odd. Degree of Aeand Aoare <= d/2
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)
Visualization What’s the problem with this recursion? Evaluate A(x) Evaluate Ae(x) and Ao(x)
Complex numbers • After the top level of the recursion, none of the points are negative – no paired points anymore. • Solution: Use complex numbers.
Complex roots of unity • Assume the “bottom” of the recursion will use +1. • Identify the n points to start with. +1 -1 +i -i • nth roots are plus minus paired • squaring them give the (n/2)th roots +1 -1 +1
Relationship between Complex Numbers and Trig. functions Euler’s Theorem Discrete Fourier Transform
Interpolation • We built the FFT to evaluate. • To Interpolate: Evaluation Coefficients Values Interpolation
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
Frame Overlapping • To construct a spectrogram, calculate the “Discrete Fourier Transform” (using the FFT) at overlapping frames. 10ms 10ms 10ms 10ms 10ms
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
Next Class • Mel Frequency Cepstral Coefficients • PLP/Rasta Features • Reading: J&M 9.3