comparison 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
comparison
equal deleted inserted replaced
3:e1cfa7765647 4:92ca03a8fa99
1 function [] = get_MFCCS( dirName, statsFileID )
2
3
4 % this function collates the results of all values calculated for the
5 % MFCCs
6
7 DEBUG=0;
8
9 % identify the speaker in the stats file
10 fprintf( statsFileID, '%s ', dirName );
11
12 metricName = '_MFCC';
13 metricFileName = [ dirName metricName '.txt'];
14 numberOfValuesPerFrame = 13; % 13 MFCC's
15
16 FileID = fopen( metricFileName );
17
18 %---------------- GET THE VOICED FRAME VALUES -------------------
19
20 % only wish to consider values from voiced frames. The MFCCs were
21 % calculate for only non-silent frames anyway, but now we need to
22 % remove the unvoiced frame values
23
24 % going to disregard all unvoiced frames as these produce outliers
25 [vuv] = detect_VoicedUnvoiced( [ dirName '.wav' ], 0 );
26
27 % get the silent frames
28 segmentFrames = detect_Silence( [ dirName '.wav' ], 0 );
29 [ silentFrames ] = getSilentDataArray( segmentFrames, length(vuv) );
30
31 % remove silent frames from vuv
32 non_silentFrames = find(silentFrames == 1);
33 vuv = vuv( non_silentFrames );
34 % voicedFrames = find( vuv == 1 );
35
36 if( FileID <= 0 ) %does the file exist?
37 % if not
38 message = ['WARNING: MISSING ' metricName ' FILE'];
39 disp( message );
40 fprintf( statsFileID, ' \s missing', metricName );
41
42 else
43 mfcc = readManyValuesFromFile( statsFileID, metricFileName, metricName, numberOfValuesPerFrame );
44 % smooth to get rid of outliers
45 % for( i=1:numberOfValuesPerFrame )
46 % % smoothedMfcc(:,i) = smooth( mfcc( voicedFrames,i ) );
47 % smoothedMfcc(:,i) = smooth( mfcc( :,i ) );
48 % end
49
50 for( i=1:numberOfValuesPerFrame )
51 % find the basic metric set for each frequency band
52 % [ metrics(i,:) ] = basicMetricSet( smoothedMfcc(:,i), statsFileID );
53 [ metrics(i,:) ] = basicMetricSet( mfcc(:,i), statsFileID );
54 mean(i) = metrics(i,1);
55 end
56
57 % find the gradient of each frequency band and its basic metric set
58 [m,n]=size(metrics);
59 for( i=1:numberOfValuesPerFrame )
60 % gradSmoothedMfcc(:,i) = gradient( smoothedMfcc(:,i) );
61 gradMfcc(:,i) = gradient( mfcc(:,i) );
62 % [ metrics(i, n+1:2*n ) ] = basicMetricSet( gradSmoothedMfcc(:,i), statsFileID );
63 [ metrics(i, n+1:2*n ) ] = basicMetricSet( gradMfcc(:,i), statsFileID );
64 end
65
66 % calculate the basic metric set for the mean of all frequency
67 % bands
68 basicMetricSet( mean, statsFileID );
69 end
70
71
72 fprintf( statsFileID, '\n');
73 fclose(FileID);