diff _misc/featureextraction/.svn/text-base/bigframefft.m.svn-base @ 8:b5b38998ef3b

added all that other stuff
author matthiasm
date Fri, 11 Apr 2014 15:54:25 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_misc/featureextraction/.svn/text-base/bigframefft.m.svn-base	Fri Apr 11 15:54:25 2014 +0100
@@ -0,0 +1,61 @@
+
+% segment audio data into overlapping frames and take fft of each frame
+
+function [fftframes,info] = bigframefft(audiodata, info)
+
+fprintf(1,'framefft\n');
+    
+info.undertest = [info.undertest '\nfft'];
+
+% set window length
+win = info.windowlength;
+
+
+% 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.*info.overlap); 
+
+info.hopsize = hop;
+
+% set number of windows
+num_win = ceil((ilength+1)/hop);
+
+info.numberframes = num_win;
+
+start=1;
+
+fftframes = zeros(win,num_win);
+
+check = ceil(num_win/10);
+
+
+% do fft analysis for each window:
+for i = 1 : num_win;
+  
+    segment = audiodata(start:(start + win - 1));
+    
+    fftframes(:,i) = fft(segment, win)';
+  
+    start = start + hop;
+    
+    if mod(i,check)  == 0
+        fprintf(1,'.');
+    end
+    
+end;
+fprintf(1,'\n');
+
+