discrete fourier transform
play

Discrete Fourier Transform Graduate School of Culture Technology - PowerPoint PPT Presentation

CTP 431 Music and Audio Computing Discrete Fourier Transform Graduate School of Culture Technology (GSCT) Juhan Nam 1 Outlines Fourier Series Fourier Transform Discrete-Time Fourier Transform Discrete Fourier Transform


  1. CTP 431 Music and Audio Computing Discrete Fourier Transform Graduate School of Culture Technology (GSCT) Juhan Nam 1

  2. Outlines § Fourier Series § Fourier Transform § Discrete-Time Fourier Transform § Discrete Fourier Transform – Fast Fourier Transform 2

  3. Fourier Series § Recall the “modes” in oscillation: the periodic signal x(t) with period T can be represented as ∞ x ( t ) = 1 ∑ r k sin(2 π kt / T ) N k = 1 – Correct? § General form of a periodic signal x(t) with period T – Add phase and D.C. offset ∞ x ( t ) = a 0 + 1 ∑ r k sin(2 π kt / T + φ ( k )) N k = 1 ∞ x ( t ) = a 0 + 1 ∑ ( a k cos(2 π kt / T ) + b k sin(2 π kt / T )) N k = 1 3

  4. Fourier Series § How can you get the coefficients? – Use the orthogonality of sinusoids T /2 ∫ cos(2 π mt / T )sin(2 π nt / T ) dt = 0 − T /2 $ T /2 T ( m = n ) & ∫ cos(2 π mt / T )cos(2 π nt / T ) dt = % 0 ( m ≠ n ) & ' − T /2 § Coefficients T /2 a k = 1 ∫ x ( t )cos(2 π kt / T ) dt T /2 T a 0 = 1 − T /2 ∫ x ( t ) dt T T /2 b k = 1 − T /2 ∫ x ( t )sin(2 π kt / T ) dt T − T /2 4

  5. Fourier Transform § What if the signal is not periodic? T → ∞ – An aperiodic signal can be approximated by – Angular frequency ω k = 2 π k / T = 2 π ( kF ) → ω = 2 π f Discrete ¡frequency ¡ Con0nuous ¡frequency ¡ § The general form is converted to ∞ ∫ x ( t ) = ( A ( ω )cos( ω t ) + B ( ω )sin( ω t )) d ω 0 § The coefficients are to ∞ ∞ A ( ω ) = 1 B ( ω ) = 1 ∫ ∫ x ( t )cos( ω t ) dt x ( t )sin( ω t ) dt π π −∞ −∞ 5

  6. Fourier Transform § Can we represent the transform in a simpler form? – Combine A(w) and B(w) into a single term – Amplitude and phase are explicit – Explain the properties of Fourier transform easily 6

  7. Fourier Transform § Euler’s identity e j θ = cos θ + j sin θ – Proof) Taylor’s series θ = π e j π + 1 = 0 – If , (“the most beautiful equation in math”) § Properties cos θ = e j θ + e − j θ sin θ = e j θ − e − j θ 2 2 j 7

  8. Fourier Transform § Plugging Euler’s identify in Fourier transform ∞ x ( t ) = 1 ( A ' ( ω )cos( ω t ) + B ' ( ω )sin( ω t )) d ω ∫ 2 π −∞ ∞ ∞ A ' ( ω ) = π A ( ω ) = B ' ( ω ) = π B ( ω ) = ∫ ∫ x ( t )cos( ω t ) dt x ( t )sin( ω t ) dt −∞ −∞ § Fourier Transform ∞ ∞ F ( ω ) = A ' ( ω ) − jB ' ( ω ) = x ( t ) e − j ω t ∫ ∫ x ( t )(cos( ω t ) − j sin( ω t )) dt = dt −∞ −∞ ∞ x ( t ) e − j ω t ∫ F ( ω ) = dt −∞ 8

  9. Fourier Transform § Inverse Fourier Transform ∞ x ( t ) = 1 ( A ' ( ω )cos( ω t ) + B ' ( ω )sin( ω t )) d ω ∫ 2 π −∞ ( A ' ( ω )( e j ω t + e − j ω t + B ' ( ω )( e j ω t − e − j ω t ∞ x ( t ) = 1 ∫ ) )) d ω 2 π 2 2 j −∞ ∞ x ( t ) = 1 1 + 1 2 ( A ' ( ω ) − jB ' ( ω )) e j ω t 2 ( A ' ( ω ) + jB ' ( ω )) e − j ω t d ω ∫ 2 π −∞ ∞ ∞ x ( t ) = 1 (1 + 1 2 F ( ω ) e j ω t ) d ω = Real{ 1 ∫ 2 F ( ω ) e j ω t ∫ F ( ω ) e j ω t d ω } 2 π 2 π −∞ −∞ ∞ x ( t ) = 1 F ( ω ) e j ω t ∫ d ω 2 π −∞ 9

  10. Discrete-Time Fourier Transform (DTFT) § DTFT – Time is sampled ∞ ∑ x ( n ) e − j ω n F ( ω ) = −∞ § Inverse DTFT – is periodic in frequency domain F ( ω ) π x ( t ) = 1 F ( ω ) e j ω t ∫ d ω 2 π − π 10

  11. Discrete Fourier Transform § Now, what if the discrete signal is finite in length ( N ) ? – This is the signal that we really handle x ( n ) = [ x 0 , x 1 , x 2 , ! , x N − 1 ] § We assume that x(n) is periodic with period N – Periodic in time à Sampling in frequency → ω k = 2 π kf k = 2 π k / N ω = 2 π f Con0nuous ¡frequency ¡ Discrete ¡frequency ¡ 11

  12. Discrete Fourier Transform § Discrete Fourier Transform N − 1 ∑ x ( n ) e − j 2 π kn / N X ( k ) = = X R ( k ) + jX I ( k ) n = 0 2 ( k ) + X I 2 ( k ) – Magnitude spectrum: X ( k ) = A ( k ) = X R ∠ X ( k ) = Θ ( k ) = tan − 1 ( X I ( k ) – Phase spectrum: X R ( k )) § Inverse Discrete Fourier Transform N − 1 x ( n ) = 1 ∑ X ( k ) e j 2 π kn / N N k = 0 12

  13. (Extra) Discrete Fourier Transform § Can we represent x(n) with a finite set of sinusoids? – Finding A ( k ), φ ( k ) N − 1 x ( n ) = 1 ∑ A ( k )cos(2 π kn / N + φ ( k )) N k = 0 § Orthogonality of Sinusoids – Inner product between two sinusoids # N − 1 N / 2 if p = q or p = N − q % ∑ cos(2 π pn / N )cos(2 π qn / N )) = $ 0 otherwise % N − 1 & n = 0 ∑ cos(2 π pn / N )sin(2 π qn / N )) = 0 # 0 otherwise n = 0 % N − 1 ∑ sin(2 π pn / N )sin(2 π qn / N )) = N / 2 if p = q $ % n = 0 − N / 2 if p = N − q % & 13

  14. (Extra) Discrete Fourier Transform § Do the inner product with the signal and sinusoids X R ( k ) = A ( k )cos Θ ( k ) N − 1 x ( n ) = 1 ∑ ( X R ( k )cos(2 π kn / N ) − X I ( k )sin(2 π kn / N )) X I ( k ) = A ( k )sin Θ ( k ) N k = 0 N − 1 N − 1 ∑ ∑ X R ( k ) = x ( n )cos(2 π kn / N ) X I ( k ) = − x ( n )sin(2 π kn / N ) n = 0 n = 0 We ¡assume ¡that ¡ ¡ A ( k ) = A ( N − k ) § Using Euler’s Identity N − 1 ∑ x ( n ) e − j 2 π kn / N X ( k ) = X R ( k ) + jX I ( k ) = n = 0 14

  15. (Extra) Discrete Fourier Transform § Now the inverse discrete Fourier transform is derived as N − 1 x ( n ) = 1 ∑ A ( k )cos(2 π kn / N + Θ ( k )) N k = 0 N − 1 = 1 ∑ A ( k )( e j (2 π kn / N + Θ ( k )) + e − j (2 π kn / N + Θ ( k )) ) / 2 N k = 0 N − 1 = 1 + X ( k ) e − j 2 π kn / N ) / 2 ∑ ( X ( k ) e j 2 π kn / N N k = 0 N − 1 N − 1 = Real{ 1 X ( k ) e j 2 π kn / N } = 1 ∑ ∑ X ( k ) e j 2 π kn / N N N k = 0 k = 0 15

  16. Fast Fourier Transform § Matrix multiplication view of DFT § In fact, we don’t compute this directly. There is a more efficiently way, which is called “Fast Fourier Transform (FFT)” – Complexity reduction by FFT: O( N 2 ) à O( N log 2 N ) – Divide and conquer 16

  17. Examples of DFT Sine ¡waveform ¡ Drum ¡ Flute ¡ 17

  18. Properties of DFT § Linearity: ax 1 ( n ) + bx 2 ( n ) ↔ aX 1 ( k ) + bX 2 ( k ) x ( n − m ) ↔ e − j 2 π mk / N X ( k ) § Shift: e j 2 π mn / N x ( n ) ↔ X ( k − m ) § Modulation (frequency shift): § Symmetry – If x(n) is real, the magnitude is even-symmetry and the phase is odd-symmetry § Convolution: x 1 ( n )* x 2 ( n ) ↔ X 1 ( k ) X 2 ( k ) x 1 ( n ) x 2 ( n ) ↔ X 1 ( k )* X 2 ( k ) (Duality) ¡ 18

  19. Zero-padding § Adding zeros to a windowed frame in time domain – Corresponds to “ideal interpolation” in frequency domain – In practice, FFT size increases by the size of zero-padding 19

  20. Demo: Fourier Series § Web Audio Demo – http://codepen.io/anon/pen/jPGJMK (additive synthesis) 20

Recommend


More recommend