Attachment 'sfft.m'
Download 1 function S = sfft(s, window, shift)
2 %
3 % short time FFT, S = sfft(s, window, shift)
4 %
5
6 frameSize = length(window);
7 sLength = length(s);
8 %nFrame = ceil( (sLength-frameSize)/shift )+1;
9 nFrame = ceil( (sLength-frameSize)/shift );
10
11 if ( nFrame < 1 ), nFrame = 1; end % for the case sLength < frameSize
12 % adjusting the length of s, padding zero
13 adjustLength = shift*(nFrame-1) + frameSize;
14 s = [s; zeros(adjustLength-sLength,1)]; % column vector
15
16 S=zeros(frameSize, nFrame);
17
18 begintime=1;
19 endtime=frameSize;
20
21 for i=1:nFrame,
22 windowed_signal = s(begintime:endtime) .* window;
23 S(:,i) = fft(windowed_signal); % rows = frequency bins, columns = number of frames
24 begintime = begintime + shift;
25 endtime = endtime + shift;
26 end;
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.