Matrix form:
X[k] = x[n]W
N
kn
n=0
N1
W
N
= e
j
2
N
( )
W
N
r
has only
N distinct values
W
N
@2/N
Structure
opportunities
for
efficiency
X[0]
X[1]
X[2]
.
.
.
X[N 1]
1 1 1 1
1 W
1
N
W
2
N
W
(N1)
N
1 W
2
N
W
4
N
W
2(N1)
N
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1 W
(N1)
N
W
2(N1)
N
W
(N1)
2
N
x[0]
x[1]
x[2]
.
.
.
x[N 1]
N complex multiplies
+ N-1 complex adds per point (k)
N points (k = 0.. N-1)
N points: 4N
2
real mults, 4N
2
-2N real adds
X[k] = x[n]W
N
kn
n=0
N1
Now:
i.e.
where
X k
[ ]
= x
[ ]
W
N
k
=0
N1
= W
N
kN
x
[ ]
W
N
k N
( )
looks like a
convolution
X k
[ ]
= y
k
N
[ ]
y
k
n
[ ]
= x
e
n
[ ]
h
k
[n]
x
e
[n] = {
x[n] 0 n < N
0 n = N
h
k
[n] = {
W
N
-kn
n 0
0 n < 0
+
z
-1
W
N
-k
x
e
[n]
x
e
[N] = 0
y
k
[n]
y
k
[-1] = 0
y
k
[N] = X[k]
2012-11-28 Dan Ellis 6
Goertzels Algorithm
= x 2m
[ ]
W
N
2mk
+ x 2m+1
[ ]
W
N
2m+1
( )
k
( )
m=0
N
2
1
= x 2m
[ ]
W
N
2
mk
m=0
N
2
1
+W
N
k
x 2m+1
[ ]
W
N
2
mk
m=0
N
2
1
But if DFT
N
{} ~ O(N
2
)
then DFT
N/2
{} ~ O((N/2)
2
) = 1/4 O(N
2
)
Total computation ~ 2 1/4 O(N
2
)
= 1/2 the computation (+") of direct DFT
DFT
N
x n
[ ] { }
= DFT
N
2
x
0
n
[ ] { }
+W
N
k
DFT
N
2
x
1
n
[ ] { }
x[n] for even n x[n] for odd n
2012-11-28 Dan Ellis 10
One-Stage DIT Flowgraph
Classic FFT structure
Even
points
from
x[n]
Odd
points
from
x[n]
Same as
X[0..3]
except for
factors on
X
1
[]
terms
twiddle factors:
always apply to
odd-terms output
NOT mirror-image
X k
[ ]
= X
0
k
N
2
[ ]
+W
N
k
X
1
k
N
2
[ ]
x[0]
x[2]
x[4]
x[6]
x[1]
x[3]
x[5]
x[7]
X[0]
X[1]
X[2]
X[3]
X[4]
X[5]
X[6]
X[7]
X
0
[0]
X
0
[1]
X
0
[2]
X
0
[3]
X
1
[0]
X
1
[1]
X
1
[2]
X
1
[3]
DFT
N
2
DFT
N
2
W
N
0
W
N
1
W
N
2
W
N
3
W
N
4
W
N
5
W
N
6
W
N
7
2012-11-28 Dan Ellis 11
i.e.
make:
Similarly,
Multiple DIT Stages
X k
[ ]
= X
0
k
N
2
[ ]
+W
N
k
X
1
k
N
2
[ ]
0 k < N
X
0
k
[ ]
= X
00
k
N
4
[ ]
+W
N
2
k
X
01
k
N
4
[ ]
0 k < N/2
N/4-pt DFT of even points
in even subset of x[n]
N/4-pt DFT of odd points
from even subset
X
1
k
[ ]
= X
10
k
N
4
[ ]
+W
N
2
k
X
11
k
N
4
[ ]
2012-11-28 Dan Ellis 12
Two-Stage DIT Flowgraph
x[0]
x[4]
x[2]
x[6]
x[1]
x[5]
x[3]
x[7]
X[0]
X[1]
X[2]
X[3]
X[4]
X[5]
X[6]
X[7]
X
0
[0]
X
00
X
01
X
10
X
11
X
0
[1]
X
0
[2]
X
0
[3]
X
1
[0]
X
1
[1]
X
1
[2]
X
1
[3]
DFT
N
4
DFT
N
4
DFT
N
4
DFT
N
4
W
N
0
W
N
1
W
N
2
W
N
3
W
N
4
W
N
5
W
N
6
W
N
7
W
N/2
3
W
N/2
0
W
N/2
3
W
N/2
0
different from before same as before
2012-11-28 Dan Ellis 13
Multi-stage DIT FFT
Can simplify:
W
N
r
W
N
r+N/2
X
X
[r]
X
X
[r+N/2]
X
X0
[r]
X
X1
[r]
2 cpx mults
X
X
[r]
X
X
[r+N/2]
X
X0
[r]
X
X1
[r]
W
N
r
-1
just one cpx mult!
i.e. SUB rather than ADD
2012-11-28 Dan Ellis 15
8-pt DIT FFT Flowgraph
W
N
0
disappears
Having N = 2
M
meant we could divide
each stage into 2 halves = radix-2 FFT
N = 3
M
radix-3
N = 4
M
radix-4 - more optimized radix-2
etc...
Recall IDFT:
Thus:
only differences
from forward DFT
Nx
*
[n] = X[k]W
N
nk
( )
*
k=0
N1
= X
*
[k]W
N
nk
k=0
N1
*
2012-11-28 Dan Ellis 18
Spectrum of
whole sequence
indicates
modulation
indirectly...
... as
cancellation
between
closely-
tuned
sines
2cAcB
= cA+B
+cA-B
Nsin2kn
N
-Nsin2(k-1)n
N 2
-Nsin2(k+1)n
N 2
0 0.02 0.04 0.06 0.08
0
200
400
600
N
N/2
\X[k]\
WP
k/(N/2)
-1
-0.5
0
0.5
1
-1
-0.5
0
0.5
1
0 128 256 384 512 640 768 896
-1
-0.5
0
0.5
1
M
2012-11-28 Dan Ellis 21
Fourier Transform of AM Sine
A[n] varies on a
different (slower) timescale
One approach:
frequency
index
time
index
N
FT
points of x
starting at n
window
DFT
kernel
2012-11-28 Dan Ellis 25
STFT Window Shape
e.g. rectangular
selects x[n], n
0
n < n
0
+N
W
Alternate tilings
of time-freq:
disks show blurring
due to window length;
area of disk is constant
Uncertainty principle:
ft k
half-length window half as many DFT samples
0 100 200 300
0
0.5
1
0
50
100
150
200
250
n
k
2012-11-28 Dan Ellis 29
Spectrograms of Real Sounds
individual t-f
cells merge
into continuous
image
time-domain
successive
short
DFTs
time / s
time / s
f
r
e
q
/
H
z
i
n
t
e
n
s
i
t
y
/
d
B
2.35 2.4 2.45 2.5 2.55 2.6
0
1000
2000
3000
4000
f
r
e
q
/
H
z
0
1000
2000
3000
4000
0
0.1
-50
-40
-30
-20
-10
0
10
0 0.5 1 1.5 2 2.5
2012-11-28 Dan Ellis 30
Narrowband vs. Wideband
= h
k
m
[ ]
x n
0
m
[ ]
m=0
N1
( )
h
k
n
[ ]
= w n
[ ]
e
j
2kn
N
just one freq.
convolution
with
complex IR
2012-11-28 Dan Ellis 33
STFT as a Filterbank
If
then
e.g. if
then
Can shift by n
0
, combine, to get x[n]:
Prefer to
overlap windows:
i.e. sample X[k,n
0
]
at n
0
= rH where H = N/2 (for example)
Then
hopsize window length
x n
[ ]
= x n
[ ]
w n rH
[ ]
r
= x n
[ ]
w n rH
[ ]
r
=1
if
n
^
x[n]
x[n]w[n-rH]
2012-11-28 Dan Ellis 36
STFT Analysis-Synthesis