Mercurial > hg > mauch-mirex-2010
view _misc/featureextraction/myframefft.m~ @ 9:4ea6619cb3f5 tip
removed log files
author | matthiasm |
---|---|
date | Fri, 11 Apr 2014 15:55:11 +0100 |
parents | b5b38998ef3b |
children |
line wrap: on
line source
% segment audio data into overlapping frames and take fft of each frame function fftframes = myframefft(audiodata, winlength, overlap, windowkind, varargin) if nargin > 4 nPad = varargin{1}; zeropadding = true; end fprintf(1,''); win = winlength; % Pad audio with zeros so that first analysis frame corresponds with first % audio sample pad = zeros((win/2),1); %audiodata = [pad; audiodata; pad]; % find size of input ilength = length(audiodata); %pad audio data audiodata = [pad; audiodata; pad]; % set hop size hop = fix(win.*overlap); % set number of windows num_win = ceil((ilength+1)/win/overlap); start=1; fftframes = zeros(win,num_win); check = ceil(num_win/10); if windowkind == 'hamming' window = hamming(win); else window = rectwin(win); end % do fft analysis for each window: for i = 1 : num_win; start = floor(win * overlap * (i-1) + 1); if ~zeropadding segment = window .* audiodata(start:(start + win - 1)); fftframes(:,i) = fft(segment, win)'; else segment = [window .* audiodata(start:(start + win - 1)) zeros(nPad*win)]; fftframes(:,i) = fft(segment, win)'; end % start = start + hop if mod(i,check) == 0 fprintf(1,'.'); end end; fprintf(1,'\n');