Mercurial > hg > emotion-detection-top-level
comparison Code/Descriptors/Matlab/MPEG7/FromWeb/VoiceSauce/func_OtherPitch.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 [F0, err_msg] = func_OtherPitch(wavfile, handles) | |
2 % [F0, err] = func_SnackPitch(wavfile, windowsize, frameshift, maxF0, minF0) | |
3 % Input: wavfile - input wav file | |
4 % Output: F0 | |
5 % err_msg - message of error | |
6 % Notes: Function attempts to call an external command to produce an F0 | |
7 % output file which is read back as a vector. F0 output file format should | |
8 % be a column of F0 values for each frame | |
9 % | |
10 % Warning: experimental function | |
11 % | |
12 % Author: Yen-Liang Shue, Speech Processing and Auditory Perception Laboratory, UCLA | |
13 % Copyright UCLA SPAPL 2009 | |
14 | |
15 % get settings and commands | |
16 VSData = guidata(handles.VSHandle); | |
17 outfile = [wavfile(1:end-3) 'f0']; | |
18 | |
19 C = textscan(VSData.vars.F0OtherCommand, '%s', 'delimiter', ' '); | |
20 C = C{1}; | |
21 | |
22 command = []; | |
23 F0 = NaN; | |
24 err_msg = []; | |
25 | |
26 for k=1:length(C) | |
27 if (strcmp(C{k}, '$wavfile')) | |
28 command = [command wavfile ' ']; | |
29 elseif (strcmp(C{k}, '$outfile')) | |
30 command = [command outfile ' ']; | |
31 else | |
32 command = [command C{k} ' ']; | |
33 end | |
34 end | |
35 | |
36 % attempt to run command | |
37 [status, results] = system(command); | |
38 | |
39 % error occured, exit | |
40 if (status ~= 0) | |
41 err_msg = 'Unable to execute command.'; | |
42 | |
43 % try to clean up files | |
44 if (exist(outfile, 'file') ~= 0) | |
45 delete(outfile); | |
46 end | |
47 | |
48 return; | |
49 end | |
50 | |
51 % now check if outfile exists | |
52 if (exist(outfile, 'file') == 0) | |
53 err_msg = 'Unable to find F0 file.'; | |
54 return; | |
55 end | |
56 | |
57 % if file exists, read in the vectors | |
58 fid = fopen(outfile, 'rt'); | |
59 if (fid == -1) | |
60 err_msg = 'Unable to open F0 file.'; | |
61 return; | |
62 end | |
63 | |
64 C = textscan(fid, '%f'); | |
65 fclose(fid); | |
66 F0 = C{1}; | |
67 | |
68 | |
69 % clean up | |
70 delete(outfile); | |
71 |