310 likes | 607 Views
Discrete Fourier Transform (DFT). Jyh-Shing Roger Jang ( 張智星 ) MIR Lab ( 多媒體資訊檢索實驗室 ) CSIE, NTU ( 台灣大學 資訊工程系 ) jang@mirlab.org , http://mirlab.org/jang. Discrete Fourier Transform. Goal
E N D
Discrete Fourier Transform (DFT) Jyh-Shing Roger Jang (張智星) MIR Lab (多媒體資訊檢索實驗室) CSIE, NTU (台灣大學 資訊工程系) jang@mirlab.org, http://mirlab.org/jang
Discrete Fourier Transform • Goal • Decompose a given stream of signals into sinusoidal components, where the amplitudes can be view as energy distribution over a range of frequencies • Applications • Speech recognition • Digital filtering • Many many more...
Decomposition • Given xn=x(n/fs), n=0~N-1, we want to decompose x(t) into a linear combination of sinusoidal functions. • Frequencies of these sinusoidal basis functions (aka “bin frequencies”):
Decomposition into Basis Functions No. of modifiable parameters = N
Decomposition into Basis Functions • Overall expression: • No. of parameters is 1+2*(N/2-1)+1=N, which is equal to the no. of data points Exact solution is likely to exist. Amplitude Freq= Phase
Parameter Identification • How to identify coefficients of the basis functions: • Fast Fourier transform (FFT) • A fast algorithm with a complexity of O(n log n) • Solving simultaneous linear equations • Integration (which take advantage of the orthogonality of the basis functions)
Frequencies of Basis Functions • Due to Euler identity, we can express the k-th term shown on the right.
Frequencies of Basis Functions • Plug in the simplified k-th term: • Include the first and last terms:
Representations of DFT: Two-side • Characteristics • General representation • If x is complex, then c is not conjugate symmetric • MATLAB command: c=fft(x)
Representations of DFT: One-side • Characteristics • When x is real, c is conjugate symmetric and we only have to look at one-side of FFT result. • MATLAB command: magSpec=fftOneside(x) Real Real Complex conjugate
Representations of DFT: One-side • Formulas
Example: Conjugate Symmetric • Conjugate symmetric of DFT for real x • fftSym01.m
Example: Two-side FFT • Two-side FFT of a pure sinusoid at one of the bin freqency • fft01.m
Example: Two-side FFT • Two-side FFT of a pure sinusoid NOT at one of the bin freqency • fft02.m
Example: One-side FFT • One-side FFT of a pure sinusoid NOT at one of the bin freqency • fft03.m
Example: One-side FFT • One-side FFT of a frame of audio signals • fft04.m
Example: FFT for Data Compression • Use partial coefficients to reconstruct the original signals • fftApproximate01.m • High-frequency components are not so important
Example: FFT for Data Compression • Use low-freq components to reconstruct a frame • fftApproximate01.m
Example: FFT for Periodic Signals • FFT on periodic signals • fftRepeat01.m • Useful for pitch tracking • Intepretation of harmonics from viewpoints of • Integration for obtaining the coefficients • Approximation by basis functions
Example: Zero-padding for FFT • Zero-padding • Purpose • Easier for FFT • Interpolation • fftRepeat01.m
Example: Down-sampling • Down sampling • High-frequency components are missing • fftResample01.m
Harmonics • Why do we have harmonic structures in a power spectrum? • Since the original frame is quasi-periodic… • If we want to use the spectrum for pitch tracking, we need to enhance the harmonics. How?
How to Enhance Harmonics? • Goal • Enhance harmonics for pitch tracking • Approach • Take an integer number of fundamental periods Hard! • Use windowing • Use zero-padding for better resolution
Example: Harmonics Enhancement (1) • fftHarmonics01.m
Example: Harmonics Enhancement (2) • fftHarmonics02.m
Example: Harmonics Enhancement (3) • fftHarmonics03.m