Dawn@4: function [] = get_MFCCS( dirName, statsFileID ) Dawn@4: Dawn@4: Dawn@4: % this function collates the results of all values calculated for the Dawn@4: % MFCCs Dawn@4: Dawn@4: DEBUG=0; Dawn@4: Dawn@4: % identify the speaker in the stats file Dawn@4: fprintf( statsFileID, '%s ', dirName ); Dawn@4: Dawn@4: metricName = '_MFCC'; Dawn@4: metricFileName = [ dirName metricName '.txt']; Dawn@4: numberOfValuesPerFrame = 13; % 13 MFCC's Dawn@4: Dawn@4: FileID = fopen( metricFileName ); Dawn@4: Dawn@4: %---------------- GET THE VOICED FRAME VALUES ------------------- Dawn@4: Dawn@4: % only wish to consider values from voiced frames. The MFCCs were Dawn@4: % calculate for only non-silent frames anyway, but now we need to Dawn@4: % remove the unvoiced frame values Dawn@4: Dawn@4: % going to disregard all unvoiced frames as these produce outliers Dawn@4: [vuv] = detect_VoicedUnvoiced( [ dirName '.wav' ], 0 ); Dawn@4: Dawn@4: % get the silent frames Dawn@4: segmentFrames = detect_Silence( [ dirName '.wav' ], 0 ); Dawn@4: [ silentFrames ] = getSilentDataArray( segmentFrames, length(vuv) ); Dawn@4: Dawn@4: % remove silent frames from vuv Dawn@4: non_silentFrames = find(silentFrames == 1); Dawn@4: vuv = vuv( non_silentFrames ); Dawn@4: % voicedFrames = find( vuv == 1 ); Dawn@4: Dawn@4: if( FileID <= 0 ) %does the file exist? Dawn@4: % if not Dawn@4: message = ['WARNING: MISSING ' metricName ' FILE']; Dawn@4: disp( message ); Dawn@4: fprintf( statsFileID, ' \s missing', metricName ); Dawn@4: Dawn@4: else Dawn@4: mfcc = readManyValuesFromFile( statsFileID, metricFileName, metricName, numberOfValuesPerFrame ); Dawn@4: % smooth to get rid of outliers Dawn@4: % for( i=1:numberOfValuesPerFrame ) Dawn@4: % % smoothedMfcc(:,i) = smooth( mfcc( voicedFrames,i ) ); Dawn@4: % smoothedMfcc(:,i) = smooth( mfcc( :,i ) ); Dawn@4: % end Dawn@4: Dawn@4: for( i=1:numberOfValuesPerFrame ) Dawn@4: % find the basic metric set for each frequency band Dawn@4: % [ metrics(i,:) ] = basicMetricSet( smoothedMfcc(:,i), statsFileID ); Dawn@4: [ metrics(i,:) ] = basicMetricSet( mfcc(:,i), statsFileID ); Dawn@4: mean(i) = metrics(i,1); Dawn@4: end Dawn@4: Dawn@4: % find the gradient of each frequency band and its basic metric set Dawn@4: [m,n]=size(metrics); Dawn@4: for( i=1:numberOfValuesPerFrame ) Dawn@4: % gradSmoothedMfcc(:,i) = gradient( smoothedMfcc(:,i) ); Dawn@4: gradMfcc(:,i) = gradient( mfcc(:,i) ); Dawn@4: % [ metrics(i, n+1:2*n ) ] = basicMetricSet( gradSmoothedMfcc(:,i), statsFileID ); Dawn@4: [ metrics(i, n+1:2*n ) ] = basicMetricSet( gradMfcc(:,i), statsFileID ); Dawn@4: end Dawn@4: Dawn@4: % calculate the basic metric set for the mean of all frequency Dawn@4: % bands Dawn@4: basicMetricSet( mean, statsFileID ); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: fprintf( statsFileID, '\n'); Dawn@4: fclose(FileID);