dawn@0
|
1 function [] = ProcessDatabase( databaseName, functionName, sampleStartNum, OVERWRITE )
|
dawn@0
|
2 % run from D:\Dropbox\BUPTResearch2011\EmotionDetectionCode\Code
|
dawn@0
|
3 machineName = getenv('COMPUTERNAME');
|
Dawn@4
|
4 fclose('all');
|
dawn@0
|
5
|
dawn@0
|
6 switch machineName
|
dawn@0
|
7 case 'LAPTOP'
|
dawn@0
|
8 % for Dawn's laptop
|
dawn@0
|
9 root = 'D:\Dropbox\'
|
dawn@0
|
10 case 'SLATE1'
|
dawn@0
|
11 % for Dawn's Slate
|
dawn@0
|
12 root = 'E:\Dropbox\'
|
dawn@0
|
13 case 'DAWNBLACK-PC'
|
dawn@0
|
14 % for Dawn's work PC
|
dawn@0
|
15 root = 'C:\Users\dawn\Dropbox\'
|
dawn@0
|
16 end
|
dawn@0
|
17
|
dawn@0
|
18 addpath ([root 'BUPTResearch2011\emotionDetectionCode\Code'])
|
dawn@0
|
19 addpath ([root 'BUPTResearch2011\emotionDetectionCode\Code\Descriptors\Matlab\MPEG7'])
|
dawn@0
|
20 addpath ([root 'BUPTResearch2011\emotionDetectionCode\Code\Descriptors\Matlab\Common'])
|
dawn@0
|
21 addpath ([root 'BUPTResearch2011\emotionDetectionCode\Code\Descriptors\Matlab\MPEG7\FromWeb'])
|
dawn@0
|
22 addpath ([root 'BUPTResearch2011\emotionDetectionCode\Code\Descriptors\PRAAT'])
|
Dawn@4
|
23 addpath ([root 'BUPTResearch2011\emotionDetectionCode\Code\Descriptors\Matlab\Speech'])
|
Dawn@4
|
24 addpath ([root 'BUPTResearch2011\emotionDetectionCode\Code\Descriptors\yin\'])
|
dawn@0
|
25 addpath ([root 'BUPTResearch2011\emotionDetectionCode\Code\Collation'])
|
dawn@0
|
26 addpath ([root 'BUPTResearch2011\emotionDetectionCode\Code\General'])
|
dawn@0
|
27
|
dawn@0
|
28 switch databaseName
|
Dawn@4
|
29 case 'ChineseOperaTest'
|
dawn@0
|
30 cd([root 'BUPTResearch2011/Data/Opera/TestDatabase'])
|
dawn@0
|
31 startEmotion = 4;
|
Dawn@4
|
32 case 'ChineseOperaFull'
|
Dawn@4
|
33 cd([root 'BUPTResearch2011/Data/Opera/FullDatabase'])
|
Dawn@4
|
34 startEmotion = 3;
|
Dawn@4
|
35 case 'ChineseOperaPaper'
|
Dawn@4
|
36 cd([root 'BUPTResearch2011/Data/Opera/PaperDatabase'])
|
Dawn@4
|
37 startEmotion = 3;
|
dawn@0
|
38 case 'MandarinSpeech'
|
dawn@0
|
39 cd([root 'BUPTResearch2011/Data/Database/EditedRecording'])
|
dawn@0
|
40 startEmotion = 3;
|
dawn@0
|
41 case 'SpeechTestFiles'
|
dawn@0
|
42 cd([root 'BUPTResearch2011\Data\SpeechTestFiles\MyAnnotatedFiles'])
|
dawn@0
|
43 startEmotion = 3;
|
dawn@0
|
44 end
|
dawn@0
|
45
|
dawn@0
|
46 fileStructure = dir;
|
dawn@0
|
47
|
dawn@0
|
48 % how many samples do we have?
|
dawn@0
|
49 noOfSamples = size( fileStructure );
|
dawn@0
|
50 firstfileOpen = 1;
|
dawn@0
|
51
|
dawn@0
|
52 if( sampleStartNum < 3 )
|
dawn@0
|
53 sampleStartNum = 3;
|
dawn@0
|
54 end
|
dawn@0
|
55
|
dawn@0
|
56 for sampleNum = sampleStartNum : noOfSamples(1)
|
dawn@0
|
57 sampleDirName = fileStructure(sampleNum).name
|
dawn@0
|
58 if( fileStructure(sampleNum).isdir == 1 ) % only directories
|
dawn@0
|
59 cd( sampleDirName );
|
dawn@0
|
60 % how many emotions for that sample?
|
dawn@0
|
61 validEmotionList = dir;
|
dawn@0
|
62 noOfEmotions = size( validEmotionList );
|
Dawn@4
|
63 % figure;
|
dawn@0
|
64 for emotionNum = startEmotion : noOfEmotions(1)
|
dawn@0
|
65 emotionName = validEmotionList(emotionNum).name;
|
dawn@0
|
66 cd( emotionName );
|
dawn@0
|
67 % how many samples for that emotion?
|
dawn@0
|
68 sampleNames = dir;
|
dawn@0
|
69 noOfSamples = size( sampleNames );
|
Dawn@4
|
70
|
dawn@0
|
71
|
dawn@0
|
72 for sampleNumber = 3 : noOfSamples(1)
|
dawn@0
|
73 if( sampleNames(sampleNumber).isdir == 0 ) % skip directories
|
dawn@0
|
74 currentSampleName = sampleNames(sampleNumber).name
|
dawn@0
|
75 % get the file type
|
dawn@0
|
76 extName = currentSampleName(length( currentSampleName ) - 3: end);
|
dawn@0
|
77 % is it a .wav file?
|
dawn@0
|
78 if strcmp( extName, '.wav' )
|
dawn@0
|
79 newDirName = currentSampleName( 1 : length( currentSampleName ) - 4 );
|
dawn@0
|
80 % if none exists, make a new directory for all the results of
|
dawn@0
|
81 % our calculations.
|
dawn@0
|
82 mkdir( [ newDirName '_metrics'] );
|
dawn@0
|
83 cd ( [ newDirName '_metrics'] );
|
dawn@0
|
84
|
dawn@0
|
85 % call your function here
|
dawn@0
|
86 switch functionName
|
dawn@0
|
87 % functions that start with 'get' simply read
|
dawn@0
|
88 % from existing text files
|
dawn@0
|
89 % functions that start with 'detect' check if
|
dawn@0
|
90 % the results file already exists, if they do
|
dawn@0
|
91 % not (or the OVERWRITE flag is true) then the
|
dawn@0
|
92 % results are calculated afresh.
|
dawn@0
|
93
|
dawn@0
|
94 % case 'getsampleDependantThresholds'
|
dawn@0
|
95 % statsFileName = '../../../../FeatureSets/singingsampleDependantThresholds.txt';
|
dawn@0
|
96 % statsFileID = fopen( statsFileName, 'a' );
|
dawn@0
|
97 % % is this the first sample in this emotion for
|
dawn@0
|
98 % % this sample?
|
dawn@0
|
99 % if( sampleNumber == 3 )
|
dawn@0
|
100 % if ( firstfileOpen == 0 )
|
dawn@0
|
101 % if(strfind( oldDirName , 'fem') > 0 )
|
dawn@0
|
102 % sampleName = oldDirName( 6 : end );
|
dawn@0
|
103 % meanET = mean( energyThreshold );
|
dawn@0
|
104 % meanSCT = mean( spectralCentroidThreshold );
|
dawn@0
|
105 % fprintf( statsFileID, '%s \t %f \t %f \n', sampleName, meanET, meanSCT );
|
dawn@0
|
106 % elseif(strfind( oldDirName , 'male') > 0 )
|
dawn@0
|
107 % sampleName = oldDirName( 6 : end );
|
dawn@0
|
108 % meanET = mean( energyThreshold );
|
dawn@0
|
109 % meanSCT = mean( spectralCentroidThreshold );
|
dawn@0
|
110 % fprintf( statsFileID, '%s \t %f \t %f \n', sampleName, meanET, meanSCT );
|
dawn@0
|
111 % end
|
dawn@0
|
112 % end
|
dawn@0
|
113 %
|
dawn@0
|
114 % spectralCentroidThreshold = [];
|
dawn@0
|
115 % energyThreshold = [];
|
dawn@0
|
116 % firstfileOpen = 0;
|
dawn@0
|
117 % end
|
dawn@0
|
118 %
|
dawn@0
|
119 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
120 % [st , et] = getsampleDependantThresholds( newDirName, x, fs, statsFileID, frameLength, noOfFrames );
|
dawn@0
|
121 % spectralCentroidThreshold = [spectralCentroidThreshold st];
|
dawn@0
|
122 % energyThreshold = [energyThreshold et];
|
dawn@0
|
123 % oldDirName = newDirName;
|
dawn@0
|
124 %
|
dawn@0
|
125 % fclose( statsFileID );
|
Dawn@4
|
126 case 'getPitchStatistics'
|
Dawn@4
|
127
|
Dawn@4
|
128 switch databaseName
|
Dawn@4
|
129 case 'ChineseOperaTest'
|
Dawn@4
|
130 statsFileName = '../../../../../../../TestResults/test_singingPitchStats_Voiced.txt';
|
Dawn@4
|
131 case 'ChineseOperaFull'
|
Dawn@4
|
132 statsFileName = '../../../../../../../TestResults/full_singingPitchStats.txt';
|
Dawn@4
|
133 case 'ChineseOperaPaper'
|
Dawn@4
|
134 statsFileName = '../../../../../../../TestResults/paper_singingPitchStats_Voiced.txt';
|
Dawn@4
|
135 case 'MandarinSpeech'
|
Dawn@4
|
136 statsFileName = '../../../../../../../TestResults/mandarinPitchStats.txt';
|
Dawn@4
|
137 case 'SpeechTestFiles'
|
Dawn@4
|
138 statsFileName = '../../../../../../../TestResults/speechPitchStats.txt';
|
Dawn@4
|
139 end
|
Dawn@4
|
140
|
Dawn@4
|
141 statsFileID = fopen( statsFileName, 'a' );
|
Dawn@4
|
142 get_Pitch( newDirName, statsFileID );
|
Dawn@4
|
143 fclose( statsFileID );
|
Dawn@4
|
144
|
Dawn@4
|
145 case 'getHNRStatistics'
|
Dawn@4
|
146 switch databaseName
|
Dawn@4
|
147 case 'ChineseOperaTest'
|
Dawn@4
|
148 statsFileName = '../../../../../../../TestResults/test_singingHNRStats.txt';
|
Dawn@4
|
149 case 'ChineseOperaPaper'
|
Dawn@4
|
150 statsFileName = '../../../../../../../TestResults/paper_singingHNRStats.txt';
|
Dawn@4
|
151 case 'ChineseOperaFull'
|
Dawn@4
|
152 statsFileName = '../../../../../../../TestResults/full_singingHNRStats.txt'
|
Dawn@4
|
153 case 'MandarinSpeech'
|
Dawn@4
|
154 statsFileName = '../../../../../../../TestResults/mandarinHNRStats.txt';
|
Dawn@4
|
155 case 'SpeechTestFiles'
|
Dawn@4
|
156 statsFileName = '../../../../../../../TestResults/speechHNRStats.txt';
|
Dawn@4
|
157 end
|
Dawn@4
|
158
|
Dawn@4
|
159 statsFileID = fopen( statsFileName, 'a' );
|
Dawn@4
|
160 get_HNR( newDirName, statsFileID );
|
Dawn@4
|
161 fclose( statsFileID );
|
Dawn@4
|
162
|
Dawn@4
|
163 case 'getEnergyStatistics'
|
Dawn@4
|
164 switch databaseName
|
Dawn@4
|
165 case 'ChineseOperaTest'
|
Dawn@4
|
166 statsFileName = '../../../../../../../TestResults/test_singingEnergyStats.txt';
|
Dawn@4
|
167 case 'ChineseOperaPaper'
|
Dawn@4
|
168 statsFileName = '../../../../../../../TestResults/paper_singingEnergyStats.txt';
|
Dawn@4
|
169 case 'ChineseOperaFull'
|
Dawn@4
|
170 statsFileName = '../../../../../../../TestResults/full_singingEnergyStats.txt'
|
Dawn@4
|
171 case 'MandarinSpeech'
|
Dawn@4
|
172 statsFileName = '../../../../../../../TestResults/mandarinEnergyStats.txt';
|
Dawn@4
|
173 case 'SpeechTestFiles'
|
Dawn@4
|
174 statsFileName = '../../../../../../../TestResults/speechEnergyStats.txt';
|
Dawn@4
|
175 end
|
Dawn@4
|
176 statsFileID = fopen( statsFileName, 'a' );
|
Dawn@4
|
177 if( firstfileOpen == 1 )
|
Dawn@4
|
178 fprintf( statsFileID, 'name \t mean energy \t energy variance \t min \t max \t mean voiced energy \t mean unvoiced energy \n');
|
Dawn@4
|
179 firstfileOpen = 0;
|
Dawn@4
|
180 end
|
Dawn@4
|
181
|
Dawn@4
|
182 get_AudioPower( newDirName, statsFileID );
|
Dawn@4
|
183 fclose( statsFileID );
|
Dawn@4
|
184
|
dawn@0
|
185 %
|
dawn@0
|
186 % case 'getEnergyStatistics'
|
dawn@0
|
187 % statsFileName = '../../../../FeatureSets/singingEnergyStats.txt';
|
dawn@0
|
188 % statsFileID = fopen( statsFileName, 'a' );
|
dawn@0
|
189 % if( firstfileOpen == 1 )
|
dawn@0
|
190 % fprintf( statsFileID, 'name \t mean energy \t mean voiced energy \t mean unvoiced energy \n');
|
dawn@0
|
191 % firstfileOpen = 0;
|
dawn@0
|
192 % end
|
dawn@0
|
193 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
194 % getEnergyStatistics( newDirName, x, fs, statsFileID, frameLength, noOfFrames );
|
dawn@0
|
195 % fclose( statsFileID );
|
dawn@0
|
196 %
|
dawn@0
|
197 %
|
dawn@0
|
198 % % %%%%% for energy-related features %%%%%
|
dawn@0
|
199 % % case 'getOtherEnergyStatistics'
|
dawn@0
|
200 % % statsFileName = '../../../../FeatureSets/singingOtherEnergyStats.txt';
|
dawn@0
|
201 % % statsFileID = fopen( statsFileName, 'a' );
|
dawn@0
|
202 % % if( firstfileOpen == 1 )
|
dawn@0
|
203 % % fprintf( statsFileID, 'name \t derivation of non silent energy \t derivation of voiced energy \t derivation of unvoiced energy \n');
|
dawn@0
|
204 % % firstfileOpen = 0;
|
dawn@0
|
205 % % end
|
dawn@0
|
206 % % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
207 % % getOtherEnergyStatistics( newDirName, x, fs, statsFileID, frameLength, noOfFrames );
|
dawn@0
|
208 % % fclose( statsFileID );
|
dawn@0
|
209 %
|
dawn@0
|
210 %
|
dawn@0
|
211 %
|
dawn@0
|
212 % case 'getBasicDescriptors'
|
dawn@0
|
213 % % includes audio waveform and audio power
|
dawn@0
|
214 % statsFileName = '../../../../FeatureSets/singingbasicDescriptors.txt';
|
dawn@0
|
215 % statsFileID = fopen( statsFileName, 'a' );
|
dawn@0
|
216 % if( firstfileOpen == 1 )
|
dawn@0
|
217 % fprintf( statsFileID, 'name \t meanAWF \t STDAWF \t minAWF \t maxAWF \t rangeAWF \t meanAP \t STDAP \t minAP \t maxAP \t rangeAP \t meanHR \t STDHR \t minHR \t maxHR \t rangeHR \n');
|
dawn@0
|
218 % firstfileOpen = 0;
|
dawn@0
|
219 % end
|
dawn@0
|
220 %
|
dawn@0
|
221 % getBasicDescriptors( newDirName, statsFileID );
|
dawn@0
|
222 % fclose( statsFileID );
|
dawn@0
|
223 % case 'getBasicSpectralDescriptors'
|
dawn@0
|
224 % % includes audio spectrum envelope, audio spectrum
|
dawn@0
|
225 % % centroid, audio spectrum spread, audio spectrum flatness
|
dawn@0
|
226 % statsFileName = '../../../../FeatureSets/singingbasicSpectralDescriptors.txt';
|
dawn@0
|
227 % statsFileID = fopen( statsFileName, 'a' );
|
dawn@0
|
228 % % Add a header column
|
dawn@0
|
229 % if( firstfileOpen == 1 )
|
dawn@0
|
230 % fprintf( statsFileID, ' name \t meanASE \t STDASE \t minASE \t maxASE \t rangeASE \t meanASC \t STDASC \t minASC \t maxASC \t rangeASC \t meanASS \t STDASS \t minASS \t maxASS \t rangeASS \t meanASF \t STDASF \t minASF \t maxASF \t rangeASF \n');
|
dawn@0
|
231 % % fprintf( statsFileID, ' name \t meanAWE \t STDAWE \t minAWE \t maxAWE \t rangeAWE \t meanAP \t STDAP \t minAP \t maxAP \t rangeAP \n');
|
dawn@0
|
232 % firstfileOpen = 0;
|
dawn@0
|
233 % end
|
dawn@0
|
234 %
|
dawn@0
|
235 % getBasicSpectralDescriptors1( newDirName, statsFileID );
|
dawn@0
|
236 % fclose( statsFileID );
|
dawn@0
|
237 % disp('NOT FINISHED');
|
dawn@0
|
238 % case 'getTemporalTimbralDescriptors'
|
dawn@0
|
239 %
|
dawn@0
|
240 % % includes log attack time and temporal
|
dawn@0
|
241 % % centroid
|
dawn@0
|
242 % statsFileName = '../../../../FeatureSets/singingtemporalTimbralDescriptors.txt';
|
dawn@0
|
243 % statsFileID = fopen( statsFileName, 'a' );
|
dawn@0
|
244 % % Add a header column
|
dawn@0
|
245 % if( firstfileOpen == 1)
|
dawn@0
|
246 % fprintf( statsFileID, ' name \t temporal centriod \t log attack time \n');
|
dawn@0
|
247 % firstfileOpen = 0;
|
dawn@0
|
248 % end
|
dawn@0
|
249 %
|
dawn@0
|
250 % getTemporalTimbralDescriptors( newDirName, statsFileID );
|
dawn@0
|
251 % fclose( statsFileID );
|
dawn@0
|
252 % case 'getSpectralTimbralDescriptors'
|
dawn@0
|
253 % % collate the Harmonic Spectral Centroid,
|
dawn@0
|
254 % % Harmonmic Spectral Deviation, Harmonic
|
dawn@0
|
255 % % Spectral Spread, Harmonic Spectral Variation
|
dawn@0
|
256 % % and Spectral Centroid
|
dawn@0
|
257 %
|
dawn@0
|
258 % statsFileName = '../../../../FeatureSets/singingspectralTimbralDescriptors.txt';
|
dawn@0
|
259 % statsFileID = fopen( statsFileName, 'a' );
|
dawn@0
|
260 % % Add a header column
|
dawn@0
|
261 % if( firstfileOpen == 1)
|
dawn@0
|
262 % fprintf( statsFileID, ' name \t HSC \t HSD \t HSS \t HSV \t SC \n');
|
dawn@0
|
263 % firstfileOpen = 0;
|
dawn@0
|
264 % end
|
dawn@0
|
265 %
|
dawn@0
|
266 % getSpectralTimbralDescriptors( newDirName, statsFileID );
|
dawn@0
|
267 % fclose( statsFileID );
|
Dawn@4
|
268 case 'getMFCCs'
|
Dawn@4
|
269
|
Dawn@4
|
270 switch databaseName
|
Dawn@4
|
271 case 'ChineseOperaTest'
|
Dawn@4
|
272 statsFileName = '../../../../../../../TestResults/test_singingMFCCStats_VoicedAndUnvoiced_Unsmoothed.txt';
|
Dawn@4
|
273 case 'ChineseOperaFull'
|
Dawn@4
|
274 statsFileName = '../../../../../../../TestResults/full_singingMFCCStats_VoicedAndUnvoiced_Unsmoothed.txt';
|
Dawn@4
|
275 case 'ChineseOperaPaper'
|
Dawn@4
|
276 statsFileName = '../../../../../../../TestResults/paper_singingMFCCStats.txt';
|
Dawn@4
|
277 case 'MandarinSpeech'
|
Dawn@4
|
278 statsFileName = '../../../../../../../TestResults/mandarinMFCCStats.txt';
|
Dawn@4
|
279 case 'SpeechTestFiles'
|
Dawn@4
|
280 statsFileName = '../../../../../../../TestResults/speechMFCCStats.txt';
|
Dawn@4
|
281 end
|
Dawn@4
|
282
|
Dawn@4
|
283 if( firstfileOpen == 1 )
|
Dawn@4
|
284 statsFileID = fopen( statsFileName, 'w' );
|
Dawn@4
|
285 firstfileOpen = 0;
|
Dawn@4
|
286 else
|
Dawn@4
|
287 statsFileID = fopen( statsFileName, 'a' );
|
Dawn@4
|
288 end
|
Dawn@4
|
289
|
Dawn@4
|
290 get_MFCCS( newDirName, statsFileID );
|
Dawn@4
|
291 fclose( statsFileID );
|
Dawn@4
|
292
|
Dawn@4
|
293
|
dawn@0
|
294 case 'getPRAAT'
|
Dawn@4
|
295 % collate all PRAAT values
|
Dawn@4
|
296 switch databaseName
|
Dawn@4
|
297 case 'ChineseOperaTest'
|
Dawn@4
|
298 statsFileName = '../../../../../../../TestResults/test_singingPRAATStats.txt';
|
Dawn@4
|
299 case 'ChineseOperaFull'
|
Dawn@4
|
300 statsFileName = '../../../../../../../TestResults/full_singingPRAATStats.txt';
|
Dawn@4
|
301 case 'ChineseOperaPaper'
|
Dawn@4
|
302 statsFileName = '../../../../../../../TestResults/paper_singingPRAATStats.txt';
|
Dawn@4
|
303 case 'MandarinSpeech'
|
Dawn@4
|
304 statsFileName = '../../../../../../../TestResults/mandarinPRAATStats.txt';
|
Dawn@4
|
305 case 'SpeechTestFiles'
|
Dawn@4
|
306 statsFileName = '../../../../../../../TestResults/speechPRAATStats.txt';
|
Dawn@4
|
307 end
|
dawn@1
|
308
|
dawn@0
|
309 % Add a header row
|
dawn@0
|
310 if( firstfileOpen == 1 )
|
dawn@1
|
311 statsFileID = fopen( statsFileName, 'w' );
|
dawn@0
|
312 fprintf( statsFileID, 'Metrics calculated using the PRAAT software. \n' );
|
dawn@1
|
313 fprintf( statsFileID, ' name \t JITTER: ddp \t local \t ppq5 \t rap \t SHIMMER: local \t dda \t apq3 \t apq5 \t apq11 \n');
|
dawn@1
|
314 fprintf( statsFileID, 'For each of the BURG FORMANTS: numberOfFormants \t meanFrequency \t varFrequency \t minFrequency \t maxFrequency \n');
|
dawn@1
|
315 fprintf( statsFileID, 'meanFrequencyDerivative \t varienceFrequencyDerivative \t minFrequencyDerivative \t max FrequencyDerivative \n');
|
dawn@1
|
316 fprintf( statsFileID, 'meanFrequency2ndDerivative \t varienceFrequency2ndDerivative \t minFrequency2ndDerivative \t max Frequency2ndDerivative \n');
|
dawn@1
|
317 fprintf( statsFileID, 'meanBandwidth \t varBandwidth \t minBandwidth \t maxBandwidth \n');
|
dawn@1
|
318 fprintf( statsFileID, 'meanBandwidthDerivative \t varBandwidthDerivative \t minBandwidthDerivative \t maxBandwidthDerivative \n');
|
dawn@1
|
319 fprintf( statsFileID, 'meanBandwidth2ndDerivative \t varBandwidth2ndDerivative \t minBandwidth2ndDerivative \t maxBandwidth2ndDerivative \n');
|
dawn@1
|
320 fprintf( statsFileID, 'For the mean of all three formants: meanFrequency \t varFrequency \t minFrequency \t maxFrequency \n');
|
dawn@1
|
321 fprintf( statsFileID, 'meanFrequencyDerivative \t varienceFrequencyDerivative \t minFrequencyDerivative \t max FrequencyDerivative \n');
|
dawn@1
|
322 fprintf( statsFileID, 'meanFrequency2ndDerivative \t varienceFrequency2ndDerivative \t minFrequency2ndDerivative \t max Frequency2ndDerivative \n');
|
dawn@0
|
323 firstfileOpen = 0;
|
dawn@1
|
324 else
|
dawn@1
|
325 statsFileID = fopen( statsFileName, 'a' );
|
dawn@1
|
326 end
|
dawn@0
|
327
|
dawn@0
|
328 get_PRAAT( newDirName, statsFileID );
|
dawn@0
|
329 fclose( statsFileID );
|
dawn@0
|
330
|
Dawn@4
|
331 case 'getJitter'
|
Dawn@4
|
332 % collate all Jitter values
|
Dawn@4
|
333 switch databaseName
|
Dawn@4
|
334 case 'ChineseOperaTest'
|
Dawn@4
|
335 statsFileName = '../../../../../../../TestResults/test_singingJitterStats.txt';
|
Dawn@4
|
336 case 'ChineseOperaFull'
|
Dawn@4
|
337 statsFileName = '../../../../../../../TestResults/full_singingJitterStats.txt';
|
Dawn@4
|
338 case 'ChineseOperaPaper'
|
Dawn@4
|
339 statsFileName = '../../../../../../../TestResults/paper_singingJitterStats.txt';
|
Dawn@4
|
340 case 'MandarinSpeech'
|
Dawn@4
|
341 statsFileName = '../../../../../../../TestResults/mandarinJitterStats.txt';
|
Dawn@4
|
342 case 'SpeechTestFiles'
|
Dawn@4
|
343 statsFileName = '../../../../../../../TestResults/speechJitterStats.txt';
|
Dawn@4
|
344 end
|
Dawn@4
|
345
|
Dawn@4
|
346 % Add a header row
|
Dawn@4
|
347 if( firstfileOpen == 1 )
|
Dawn@4
|
348 statsFileID = fopen( statsFileName, 'w' );
|
Dawn@4
|
349 fprintf( statsFileID, 'Metrics calculated using the PRAAT software. \n' );
|
Dawn@4
|
350 fprintf( statsFileID, ' name \t JITTER: ddp \t local \t ppq5 \t rap \n');
|
Dawn@4
|
351 firstfileOpen = 0;
|
Dawn@4
|
352 else
|
Dawn@4
|
353 statsFileID = fopen( statsFileName, 'a' );
|
Dawn@4
|
354 end
|
Dawn@4
|
355
|
Dawn@4
|
356 get_Jitter( newDirName, statsFileID );
|
Dawn@4
|
357 fclose( statsFileID );
|
Dawn@4
|
358
|
Dawn@4
|
359 case 'getShimmer'
|
Dawn@4
|
360 % collate all Shimmer values
|
Dawn@4
|
361 switch databaseName
|
Dawn@4
|
362 case 'ChineseOperaTest'
|
Dawn@4
|
363 statsFileName = '../../../../../../../TestResults/test_singingShimmerStats.txt';
|
Dawn@4
|
364 case 'ChineseOperaFull'
|
Dawn@4
|
365 statsFileName = '../../../../../../../TestResults/full_singingShimmerStats.txt';
|
Dawn@4
|
366 case 'ChineseOperaPaper'
|
Dawn@4
|
367 statsFileName = '../../../../../../../TestResults/paper_singingShimmerStats.txt';
|
Dawn@4
|
368 case 'MandarinSpeech'
|
Dawn@4
|
369 statsFileName = '../../../../../../../TestResults/mandarinShimmerStats.txt';
|
Dawn@4
|
370 case 'SpeechTestFiles'
|
Dawn@4
|
371 statsFileName = '../../../../../../../TestResults/speechShimmerStats.txt';
|
Dawn@4
|
372 end
|
Dawn@4
|
373
|
Dawn@4
|
374 % Add a header row
|
Dawn@4
|
375 if( firstfileOpen == 1 )
|
Dawn@4
|
376 statsFileID = fopen( statsFileName, 'w' );
|
Dawn@4
|
377 fprintf( statsFileID, 'Metrics calculated using the PRAAT software. \n' );
|
Dawn@4
|
378 fprintf( statsFileID, ' name \t SHIMMER: local \t dda \t apq3 \t apq5 \t apq11 \n');
|
Dawn@4
|
379 firstfileOpen = 0;
|
Dawn@4
|
380 else
|
Dawn@4
|
381 statsFileID = fopen( statsFileName, 'a' );
|
Dawn@4
|
382 end
|
Dawn@4
|
383
|
Dawn@4
|
384 get_Shimmer( newDirName, statsFileID );
|
Dawn@4
|
385 fclose( statsFileID );
|
Dawn@4
|
386
|
Dawn@4
|
387 case 'getFormants'
|
Dawn@4
|
388 % collate all Formants values
|
Dawn@4
|
389 switch databaseName
|
Dawn@4
|
390 case 'ChineseOperaTest'
|
Dawn@4
|
391 statsFileName = '../../../../../../../TestResults/test_singingFormantsStats.txt';
|
Dawn@4
|
392 case 'ChineseOperaFull'
|
Dawn@4
|
393 statsFileName = '../../../../../../../TestResults/full_singingFormantsStats.txt';
|
Dawn@4
|
394 case 'ChineseOperaPaper'
|
Dawn@4
|
395 statsFileName = '../../../../../../../TestResults/paper_singingFormantsStats.txt';
|
Dawn@4
|
396 case 'MandarinSpeech'
|
Dawn@4
|
397 statsFileName = '../../../../../../../TestResults/mandarinFormantsStats.txt';
|
Dawn@4
|
398 case 'SpeechTestFiles'
|
Dawn@4
|
399 statsFileName = '../../../../../../../TestResults/speechFormantsStats.txt';
|
Dawn@4
|
400 end
|
Dawn@4
|
401
|
Dawn@4
|
402 % Add a header row
|
Dawn@4
|
403 if( firstfileOpen == 1 )
|
Dawn@4
|
404 statsFileID = fopen( statsFileName, 'w' );
|
Dawn@4
|
405 fprintf( statsFileID, 'Metrics calculated using the PRAAT software. \n' );
|
Dawn@4
|
406 fprintf( statsFileID, 'For each of the BURG FORMANTS: numberOfFormants \t meanFrequency \t varFrequency \t minFrequency \t maxFrequency \n');
|
Dawn@4
|
407 fprintf( statsFileID, 'meanFrequencyDerivative \t varienceFrequencyDerivative \t minFrequencyDerivative \t max FrequencyDerivative \n');
|
Dawn@4
|
408 fprintf( statsFileID, 'meanFrequency2ndDerivative \t varienceFrequency2ndDerivative \t minFrequency2ndDerivative \t max Frequency2ndDerivative \n');
|
Dawn@4
|
409 fprintf( statsFileID, 'meanBandwidth \t varBandwidth \t minBandwidth \t maxBandwidth \n');
|
Dawn@4
|
410 fprintf( statsFileID, 'meanBandwidthDerivative \t varBandwidthDerivative \t minBandwidthDerivative \t maxBandwidthDerivative \n');
|
Dawn@4
|
411 fprintf( statsFileID, 'meanBandwidth2ndDerivative \t varBandwidth2ndDerivative \t minBandwidth2ndDerivative \t maxBandwidth2ndDerivative \n');
|
Dawn@4
|
412 fprintf( statsFileID, 'For the mean of all three formants: meanFrequency \t varFrequency \t minFrequency \t maxFrequency \n');
|
Dawn@4
|
413 fprintf( statsFileID, 'meanFrequencyDerivative \t varienceFrequencyDerivative \t minFrequencyDerivative \t max FrequencyDerivative \n');
|
Dawn@4
|
414 fprintf( statsFileID, 'meanFrequency2ndDerivative \t varienceFrequency2ndDerivative \t minFrequency2ndDerivative \t max Frequency2ndDerivative \n');
|
Dawn@4
|
415 firstfileOpen = 0;
|
Dawn@4
|
416 else
|
Dawn@4
|
417 statsFileID = fopen( statsFileName, 'a' );
|
Dawn@4
|
418 end
|
Dawn@4
|
419
|
Dawn@4
|
420 get_Formants( newDirName, statsFileID );
|
Dawn@4
|
421 fclose( statsFileID )
|
Dawn@4
|
422
|
Dawn@4
|
423
|
dawn@0
|
424 %
|
dawn@0
|
425 % %%%%% get all the pitch and energy related features
|
dawn@0
|
426
|
dawn@0
|
427
|
dawn@0
|
428 % case 'getFeaturesOfDuration'
|
dawn@0
|
429 % % collate number, mean and ratio duration of
|
dawn@0
|
430 % % unvoiced and voiced sounds, median and
|
dawn@0
|
431 % % standard deviation number of voiced sounds
|
dawn@0
|
432 % statsFileName = '../../../../FeatureSets/singingDurationStats.txt';
|
dawn@0
|
433 % statsFileID = fopen( statsFileName, 'a' );
|
dawn@0
|
434 % getFeaturesOfDuration( newDirName, statsFileID );
|
dawn@0
|
435 % fclose( statsFileID );
|
dawn@0
|
436 %
|
dawn@0
|
437 % case 'getFeaturesOfRelativePitch'
|
dawn@0
|
438 % % collate relative pitch maximum, minimum and
|
dawn@0
|
439 % % the position of those pitches
|
dawn@0
|
440 % statsFileName = '../../../../FeatureSets/singingRelativePitchStats.txt';
|
dawn@0
|
441 % statsFileID = fopen( statsFileName, 'a' );
|
dawn@0
|
442 % getFeaturesOfRelativePitch( newDirName, statsFileID );
|
dawn@0
|
443 % fclose( statsFileID );
|
dawn@0
|
444 %
|
dawn@0
|
445 % case 'getFeaturesOfRelativeEnergyGradient'
|
dawn@0
|
446 % % collate the value and position of relative
|
dawn@0
|
447 % % maximum of energy gradient
|
dawn@0
|
448 % statsFileName = '../../../../FeatureSets/singingRelativeEnergyGradientStats.txt';
|
dawn@0
|
449 % statsFileID = fopen( statsFileName, 'a' );
|
dawn@0
|
450 % getFeaturesOfRelativeEnergyGradient( newDirName, statsFileID );
|
dawn@0
|
451 % fclose( statsFileID );
|
dawn@0
|
452 %
|
dawn@0
|
453 %
|
dawn@0
|
454 %
|
dawn@0
|
455 case 'calculatePitch'
|
dawn@0
|
456 detect_pitch( currentSampleName, OVERWRITE );
|
dawn@0
|
457
|
dawn@0
|
458 case 'calculateSilence'
|
Dawn@4
|
459 detect_Silence( currentSampleName, OVERWRITE );
|
dawn@0
|
460
|
dawn@0
|
461 case 'calculateVUV'
|
dawn@0
|
462 % find the voiced and unvoiced frames using
|
dawn@0
|
463 % the harmonic ratio and pitch information
|
dawn@0
|
464 detect_VoicedUnvoiced( currentSampleName, OVERWRITE );
|
dawn@0
|
465
|
dawn@0
|
466 % case 'calculateAudioWaveform'
|
dawn@0
|
467 %
|
dawn@0
|
468 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
469 % AW_Detection( currentSampleName, x, fs, frameLength, noOfFrames );
|
dawn@0
|
470 %
|
dawn@0
|
471 % case 'calculateAudioSpectrumEnvelope'
|
dawn@0
|
472 %
|
dawn@0
|
473 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
474 % ASE_Detection( currentSampleName, x, fs, frameLength, noOfFrames );
|
dawn@0
|
475 %
|
dawn@0
|
476 % case 'calculateAudioSpectrumCentriodAndSpread'
|
dawn@0
|
477 %
|
dawn@0
|
478 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
479 % ASC_ASS_Detection( currentSampleName, x, fs, frameLength, noOfFrames );
|
dawn@0
|
480 %
|
dawn@0
|
481 % case 'calculateAudioSpectrumBasisAndProjection'
|
dawn@0
|
482 %
|
dawn@0
|
483 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
484 % ASB_ASP_Detection( currentSampleName, x, fs, frameLength, noOfFrames );
|
dawn@0
|
485 %
|
dawn@0
|
486 case 'calculateAudioPower'
|
Dawn@4
|
487 detect_AudioPower( currentSampleName, OVERWRITE );
|
dawn@0
|
488 %
|
dawn@0
|
489 % case 'calculateLogAttackTIme'
|
dawn@0
|
490 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
491 % LAT_Detection( currentSampleName, x, fs, frameLength, noOfFrames );
|
dawn@0
|
492 %
|
dawn@0
|
493 % case 'calculateTemporalCentroid'
|
dawn@0
|
494 %
|
dawn@0
|
495 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
496 % TC_Detection( currentSampleName, x, fs, frameLength, noOfFrames );
|
dawn@0
|
497 %
|
dawn@0
|
498 % case 'calculateHarmonicRatio'
|
dawn@0
|
499 %
|
dawn@0
|
500 % % can't find this function yet
|
dawn@0
|
501 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
502 % HR_Detection( currentSampleName, x, fs, frameLength, noOfFrames );
|
dawn@0
|
503 %
|
dawn@0
|
504 case 'calculateHarmonicNoiseRatio'
|
dawn@0
|
505 detect_HNR( currentSampleName, OVERWRITE );
|
dawn@0
|
506 %
|
dawn@0
|
507 % case 'calculateSpectralTimbralDescriptors'
|
dawn@0
|
508 %
|
dawn@0
|
509 % % these are best calculated together.
|
dawn@0
|
510 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
511 % spectralTimbralDescriptors( currentSampleName, x, fs, frameLength, noOfFrames );
|
dawn@0
|
512
|
Dawn@4
|
513 % case 'calculateAudioSpectrumFlatness'
|
Dawn@4
|
514 %
|
Dawn@4
|
515 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
Dawn@4
|
516 % AudioSpectralFlatness_Detection( currentSampleName, x, fs, frameLength, noOfFrames );
|
dawn@0
|
517
|
Dawn@4
|
518 case 'calculateMFCCs'
|
Dawn@4
|
519 detect_MFCC( currentSampleName, OVERWRITE );
|
dawn@0
|
520 %
|
dawn@0
|
521 % case 'calculatesampleDependantThresholds'
|
dawn@0
|
522 %
|
dawn@0
|
523 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
524 % sampleDependantThresholds( currentSampleName, x, fs, frameLength, noOfFrames );
|
dawn@0
|
525 %
|
dawn@0
|
526 %
|
dawn@0
|
527 % %%%%% pitch related features %%%%%
|
dawn@0
|
528 % case 'calculatesampleVoicedSoundDuration'
|
dawn@0
|
529 %
|
dawn@0
|
530 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
531 % getVoicedSoundDuration( currentSampleName, x, fs, noOfFrames, frameLength );
|
dawn@0
|
532 %
|
dawn@0
|
533 % case 'calculatesampleRelativePitch'
|
dawn@0
|
534 %
|
dawn@0
|
535 % singingpitchStatsFileName = 'singingpitchStats.txt';
|
dawn@0
|
536 % singingpitchStatsFileID = fopen( singingpitchStatsFileName, 'r' );
|
dawn@0
|
537 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
538 % getRelativePitch( singingpitchStatsFileID, currentSampleName, x, fs, noOfFrames, frameLength, 7 );
|
dawn@0
|
539 % fclose(singingpitchStatsFileID);
|
dawn@0
|
540 %
|
dawn@0
|
541 % case 'calculatesampleRelativePitchFeatures'
|
dawn@0
|
542 %
|
dawn@0
|
543 % singingpitchStatsFileName1 = '../../../../FeatureSets/singingpitchStats.txt';
|
dawn@0
|
544 % singingpitchStatsFileID1 = fopen( singingpitchStatsFileName1, 'r' );
|
dawn@0
|
545 % singingpitchStatsFileName2 = 'singingpitchStats.txt';
|
dawn@0
|
546 % singingpitchStatsFileID2 = fopen( singingpitchStatsFileName2, 'r' );
|
dawn@0
|
547 % [averageValues1 averageValues2 averageValues3] = getRelativePitchFeatures( singingpitchStatsFileID1, 7 );
|
dawn@0
|
548 % getEachRelativePitchFeature( singingpitchStatsFileID2, currentSampleName, 7, averageValues1, averageValues2, averageValues3 );
|
dawn@0
|
549 % fclose(singingpitchStatsFileID1);
|
dawn@0
|
550 % fclose(singingpitchStatsFileID2);
|
dawn@0
|
551 %
|
dawn@0
|
552 % case 'calculatesamplePitchPosition'
|
dawn@0
|
553 %
|
dawn@0
|
554 % singingpitchStatsFileName = 'singingpitchStats.txt';
|
dawn@0
|
555 % singingpitchStatsFileID = fopen( singingpitchStatsFileName, 'r' );
|
dawn@0
|
556 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
557 % getPitchPosition( singingpitchStatsFileID, currentSampleName, x, fs, noOfFrames, frameLength, 7 );
|
dawn@0
|
558 % fclose(singingpitchStatsFileID);
|
dawn@0
|
559 %
|
dawn@0
|
560 %
|
dawn@0
|
561 %
|
dawn@0
|
562 % %%%%% energy related features %%%%%
|
dawn@0
|
563 % case 'calculatesampleRelativeEnergyByMeanAll'
|
dawn@0
|
564 %
|
dawn@0
|
565 % singingenergyStatsFileName = '../../../../FeatureSets/singingenergyStats.txt';
|
dawn@0
|
566 % singingenergyhStatsFileID = fopen( singingenergyStatsFileName, 'r' );
|
dawn@0
|
567 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
568 % getRelativeEnergyByMeanAll( singingenergyhStatsFileID, currentSampleName, x, fs, noOfFrames, frameLength, 3 );
|
dawn@0
|
569 % fclose(singingenergyhStatsFileID);
|
dawn@0
|
570 %
|
dawn@0
|
571 % case 'calculatesampleRelativeEnergyByMeanVoiced'
|
dawn@0
|
572 %
|
dawn@0
|
573 % singingenergyStatsFileName = '../../../../FeatureSets/singingenergyStats.txt';
|
dawn@0
|
574 % singingenergyhStatsFileID = fopen( singingenergyStatsFileName, 'r' );
|
dawn@0
|
575 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
576 % getRelativeEnergy( singingenergyhStatsFileID, currentSampleName, x, fs, noOfFrames, frameLength, 3 );
|
dawn@0
|
577 % fclose(singingenergyhStatsFileID);
|
dawn@0
|
578 %
|
dawn@0
|
579 % case 'calculatesampleRelativeEnergyGradientByMeanAll'
|
dawn@0
|
580 %
|
dawn@0
|
581 % statsFileName = '../../../../FeatureSets/singingenergyStats.txt';
|
dawn@0
|
582 % statsFileID = fopen( statsFileName, 'r' );
|
dawn@0
|
583 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
584 % getRelativeEnergyGradient( statsFileID, newDirName, x, fs, noOfFrames, frameLength, 3 );
|
dawn@0
|
585 % fclose( statsFileID );
|
dawn@0
|
586 %
|
dawn@0
|
587 % case 'calculatesampleRelativeEnergyGradientFeaturesByMeanAll'
|
dawn@0
|
588 %
|
dawn@0
|
589 % [x, fs, frameLength, noOfFrames] = openFile( currentSampleName );
|
dawn@0
|
590 % getRelativeEnergyGradientFeatures( currentSampleName, x, fs, noOfFrames, frameLength );
|
dawn@0
|
591 %
|
dawn@0
|
592
|
dawn@0
|
593 end
|
dawn@0
|
594
|
dawn@0
|
595 cd ../
|
dawn@0
|
596 end
|
dawn@0
|
597 end
|
dawn@0
|
598
|
dawn@0
|
599 end
|
dawn@0
|
600 cd ../
|
dawn@0
|
601
|
dawn@0
|
602 end
|
dawn@0
|
603 cd ../
|
dawn@0
|
604 end
|
dawn@0
|
605
|
dawn@0
|
606 end
|
dawn@0
|
607
|
dawn@0
|
608 cd ../
|
dawn@0
|
609
|