Sign in

username:

password:



Not a member?

Search Online Books



Search tips

Free Online Books

Chapters

Chapter Contents:

Search Spectral Audio Signal Processing

  

Book Index | Global Index


Would you like to be notified by email when Julius Orion Smith III publishes a new entry into his blog?

  

STFT in Matlab

The following matlab segment, adapted from §F.3, illustrates the above processing steps:

Xtwz = zeros(N,nframes); % pre-allocate STFT output array
M = length(w);           % M = window length, N = FFT length
zp = zeros(N-M,1);       % zero padding (to be inserted)
xoff = 0;                % current offset in input signal x
for m=1:nframes
  xt = x(xoff+1:xoff+M); % extract frame of input data
  xtw = w .* xt;         % apply window to current frame
  xtwz = [xtw(Mo2+1:M); zp; xtw(1:Mo2)]; % windowed, zero padded
  Xtwz(:,m) = fft(xtwz); % STFT for frame m
  xoff = xoff + R;       % advance in-pointer by hop-size R
end


Order a Hardcopy of Spectral Audio Signal Processing

Previous: Two Dual Interpretations of the STFT
Next: Classic Spectrograms

written by Julius Orion Smith III
Julius Smith's background is in electrical engineering (BS Rice 1975, PhD Stanford 1983). He is presently Professor of Music and Associate Professor (by courtesy) of Electrical Engineering at Stanford's Center for Computer Research in Music and Acoustics (CCRMA), teaching courses and pursuing research related to signal processing applied to music and audio systems. See http://ccrma.stanford.edu/~jos/ for details.


Comments


 

celmoucary wrote:

6/4/2008
 
I have one question please. I would like to know how to compute the Inverse STFT after having done some computations and modifications on the array given by the STFT.
Thank you
 

JOS wrote:

6/4/2008
 
For that, you do what is called "overlap-add" reconstruction. That is, after performing the inverse FFT on each column of the Xtwz matrix, they are shifted by (m-1)*R samples (where m is the column number) and summed. See http://www.dsprelated.com/dspbooks/sasp/Overlap_Add_OLA_STFT_Processing.html
for more details.

Add a Comment
You need to login before you can post a comment (best way to prevent spam). ( Not a member? )