diff Code/Collation/get_MFCCS.m @ 4:92ca03a8fa99 tip

Update to ICASSP 2013 benchmark
author Dawn Black
date Wed, 13 Feb 2013 11:02:39 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Code/Collation/get_MFCCS.m	Wed Feb 13 11:02:39 2013 +0000
@@ -0,0 +1,73 @@
+function [] = get_MFCCS( dirName, statsFileID )
+
+
+% this function collates the results of all values calculated for the
+% MFCCs
+
+DEBUG=0;
+
+    % identify the speaker in the stats file
+    fprintf( statsFileID, '%s ', dirName );
+    
+    metricName = '_MFCC';
+    metricFileName = [ dirName metricName '.txt'];
+    numberOfValuesPerFrame = 13; % 13 MFCC's
+    
+    FileID = fopen( metricFileName );
+    
+    %---------------- GET THE VOICED FRAME VALUES -------------------
+
+    % only wish to consider values from voiced frames. The MFCCs were
+    % calculate for only non-silent frames anyway, but now we need to
+    % remove the unvoiced frame values
+    
+    % going to disregard all unvoiced frames as these produce outliers
+    [vuv] = detect_VoicedUnvoiced( [ dirName '.wav' ], 0 );
+    
+    % get the silent frames
+    segmentFrames = detect_Silence( [ dirName '.wav' ], 0 );
+    [ silentFrames ] = getSilentDataArray( segmentFrames, length(vuv) );
+    
+    % remove silent frames from vuv
+    non_silentFrames = find(silentFrames == 1);
+    vuv = vuv( non_silentFrames );
+%     voicedFrames = find( vuv == 1 );
+
+    if( FileID <= 0 ) %does the file exist?
+        % if not
+        message = ['WARNING: MISSING ' metricName ' FILE'];
+        disp( message );
+        fprintf( statsFileID, ' \s missing', metricName );
+
+    else
+        mfcc = readManyValuesFromFile( statsFileID, metricFileName, metricName, numberOfValuesPerFrame );
+        % smooth to get rid of outliers
+%         for( i=1:numberOfValuesPerFrame )
+% %             smoothedMfcc(:,i) = smooth( mfcc( voicedFrames,i ) );
+%             smoothedMfcc(:,i) = smooth( mfcc( :,i ) );
+%         end
+        
+        for( i=1:numberOfValuesPerFrame )
+            % find the basic metric set for each frequency band
+%             [ metrics(i,:) ] = basicMetricSet( smoothedMfcc(:,i), statsFileID );
+            [ metrics(i,:) ] = basicMetricSet( mfcc(:,i), statsFileID );
+            mean(i) = metrics(i,1);
+        end
+        
+        % find the gradient of each frequency band and its basic metric set
+        [m,n]=size(metrics);
+        for( i=1:numberOfValuesPerFrame )
+%             gradSmoothedMfcc(:,i) = gradient( smoothedMfcc(:,i) );
+           gradMfcc(:,i) = gradient( mfcc(:,i) );
+%             [ metrics(i, n+1:2*n ) ] = basicMetricSet( gradSmoothedMfcc(:,i), statsFileID );
+            [ metrics(i, n+1:2*n ) ] = basicMetricSet( gradMfcc(:,i), statsFileID );
+        end
+        
+        % calculate the basic metric set for the mean of all frequency
+        % bands
+        basicMetricSet( mean, statsFileID );
+    end
+    
+    
+    fprintf( statsFileID, '\n');
+    fclose(FileID);
\ No newline at end of file