My favorites | Sign in
Project Home Wiki Issues Source
Checkout   Browse   Changes  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""This file defines the Short-Time Fourier Transfor (STFT)
or more precisely the Discrete Time and Frequency STFT.
"""
from __future__ import division

from numpy import *
from numpy.fft import fft

from pytfd import helpers as h

def stft(x, w, L=None):
# L is the overlap, see http://cnx.org/content/m10570/latest/
N = len(x)
#T = len(w)
if L is None:
L = N
# Zerro pad the window
w = h.zeropad(w, N)
X_stft = []
points = range(0, N, N//L)
for i in points:
x_subset = h.subset(x, i, N)
fft_subset = fft(x_subset * w)
X_stft.append(fft_subset)
X_stft = array(X_stft).transpose()
return X_stft

def spec(x, w):
return abs(stft(x, w))

spectogram = spec

__all__ = ['stft', 'spec', 'spectogram']

Change log

r3 by edin.salkovic on Aug 6, 2008   Diff
Added the Pseudo Wigner Distribution and
the S-Method, some examples and a new
plotting module based on pyglet and
pygarrayimage
Go to: 
Project members, sign in to write a code review

Older revisions

r2 by edin.salkovic on Jun 1, 2008   Diff
Initial import of my non-public code.
All revisions of this file

File info

Size: 776 bytes, 33 lines

File properties

svn:executable
*
Powered by Google Project Hosting