comparison Code/Descriptors/Matlab/MPEG7/FromWeb/VoiceSauce/vs_SelectParameters.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 varargout = vs_SelectParameters(varargin)
2 % VS_SELECTPARAMETERS M-file for vs_SelectParameters.fig
3 % VS_SELECTPARAMETERS, by itself, creates a new VS_SELECTPARAMETERS or raises the existing
4 % singleton*.
5 %
6 % H = VS_SELECTPARAMETERS returns the handle to a new VS_SELECTPARAMETERS or the handle to
7 % the existing singleton*.
8 %
9 % VS_SELECTPARAMETERS('CALLBACK',hObject,eventData,handles,...) calls the local
10 % function named CALLBACK in VS_SELECTPARAMETERS.M with the given input arguments.
11 %
12 % VS_SELECTPARAMETERS('Property','Value',...) creates a new VS_SELECTPARAMETERS or raises the
13 % existing singleton*. Starting from the left, property value pairs are
14 % applied to the GUI before vs_SelectParameters_OpeningFcn gets called. An
15 % unrecognized property name or invalid value makes property application
16 % stop. All inputs are passed to vs_SelectParameters_OpeningFcn via varargin.
17 %
18 % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
19 % instance to run (singleton)".
20 %
21 % See also: GUIDE, GUIDATA, GUIHANDLES
22
23 % Edit the above text to modify the response to help vs_SelectParameters
24
25 % Last Modified by GUIDE v2.5 16-Oct-2009 14:30:10
26
27 % Begin initialization code - DO NOT EDIT
28 gui_Singleton = 1;
29 gui_State = struct('gui_Name', mfilename, ...
30 'gui_Singleton', gui_Singleton, ...
31 'gui_OpeningFcn', @vs_SelectParameters_OpeningFcn, ...
32 'gui_OutputFcn', @vs_SelectParameters_OutputFcn, ...
33 'gui_LayoutFcn', [] , ...
34 'gui_Callback', []);
35 if nargin && ischar(varargin{1})
36 gui_State.gui_Callback = str2func(varargin{1});
37 end
38
39 if nargout
40 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
41 else
42 gui_mainfcn(gui_State, varargin{:});
43 end
44 % End initialization code - DO NOT EDIT
45
46
47 % --- Executes just before vs_SelectParameters is made visible.
48 function vs_SelectParameters_OpeningFcn(hObject, eventdata, handles, varargin)
49 % This function has no output args, see OutputFcn.
50 % hObject handle to figure
51 % eventdata reserved - to be defined in a future version of MATLAB
52 % handles structure with handles and user data (see GUIDATA)
53 % varargin command line arguments to vs_SelectParameters (see VARARGIN)
54
55 % Choose default command line output for vs_SelectParameters
56 handles.output = hObject;
57
58 PEfig = vs_ParameterEstimation;
59 PEhandle = guidata(PEfig);
60 handles.PEfig = PEfig;
61 handles.PEhandle = PEhandle;
62 handles.VSHandle = PEhandle.VSHandle;
63
64 % get the list of parameters:
65 paramlist = func_getparameterlist();
66 paraminx = 1:length(paramlist);
67
68 % check to see if "Other" F0/FMT have been enabled
69 VSData = guidata(handles.VSHandle);
70 if (VSData.vars.F0OtherEnable == 0)
71 paraminx(func_getparameterlist('F0 (Other)')) = 0;
72 end
73
74 % check to see which formant algorithm to use
75 if (VSData.vars.FormantsOtherEnable == 0)
76 paraminx(func_getparameterlist('F1, F2, F3, F4 (Other)')) = 0;
77 end
78
79 paraminx(paraminx == 0) = [];
80 paramlist = paramlist(paraminx);
81
82 set(handles.listbox_paramlist, 'String', paramlist);
83
84 selectedparamlist = VSData.vars.PE_params;
85
86 % work out which ones to select
87 paraminx = zeros(length(paramlist), 1);
88 cnt = 1;
89 for k=1:length(paramlist)
90 for n=1:length(selectedparamlist)
91 if (strcmp(paramlist(k), selectedparamlist(n)))
92 paraminx(cnt) = k;
93 cnt = cnt + 1;
94 break;
95 end
96 end
97 end
98 paraminx(paraminx==0) = [];
99 handles.paraminx = paraminx;
100
101 set(handles.listbox_paramlist, 'Value', handles.paraminx);
102
103 if (isempty(handles.paraminx))
104 set(handles.PEhandle.edit_parameterselection, 'String', 'None');
105 elseif (length(handles.paraminx) == length(paramlist))
106 set(handles.PEhandle.edit_parameterselection, 'String', 'All');
107 else
108 set(handles.PEhandle.edit_parameterselection, 'String', 'Custom');
109 end
110
111 % Update handles structure
112 guidata(hObject, handles);
113
114 % UIWAIT makes vs_SelectParameters wait for user response (see UIRESUME)
115 % uiwait(handles.figure_SelectParameters);
116
117
118 % --- Outputs from this function are returned to the command line.
119 function varargout = vs_SelectParameters_OutputFcn(hObject, eventdata, handles)
120 % varargout cell array for returning output args (see VARARGOUT);
121 % hObject handle to figure
122 % eventdata reserved - to be defined in a future version of MATLAB
123 % handles structure with handles and user data (see GUIDATA)
124
125 % Get default command line output from handles structure
126 varargout{1} = handles.output;
127
128
129 % --- Executes on selection change in listbox_paramlist.
130 function listbox_paramlist_Callback(hObject, eventdata, handles)
131 % hObject handle to listbox_paramlist (see GCBO)
132 % eventdata reserved - to be defined in a future version of MATLAB
133 % handles structure with handles and user data (see GUIDATA)
134
135 VSData = guidata(handles.VSHandle);
136 newinx = get(hObject, 'Value');
137 handles.paraminx = setxor(handles.paraminx, newinx);
138
139 paramlist = get(hObject, 'String');
140 VSData.vars.PE_params = paramlist(handles.paraminx);
141
142 set(handles.listbox_paramlist, 'Value', handles.paraminx);
143
144 guidata(hObject, handles);
145 guidata(handles.VSHandle, VSData);
146
147 if (isempty(handles.paraminx))
148 set(handles.PEhandle.edit_parameterselection, 'String', 'None');
149 elseif (length(handles.paraminx) == length(paramlist))
150 set(handles.PEhandle.edit_parameterselection, 'String', 'All');
151 else
152 set(handles.PEhandle.edit_parameterselection, 'String', 'Custom');
153 end
154
155
156
157 % --- Executes during object creation, after setting all properties.
158 function listbox_paramlist_CreateFcn(hObject, eventdata, handles)
159 % hObject handle to listbox_paramlist (see GCBO)
160 % eventdata reserved - to be defined in a future version of MATLAB
161 % handles empty - handles not created until after all CreateFcns called
162
163 % Hint: listbox controls usually have a white background on Windows.
164 % See ISPC and COMPUTER.
165 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
166 set(hObject,'BackgroundColor','white');
167 end
168
169
170 % --- Executes on button press in pushbutton_OK.
171 function pushbutton_OK_Callback(hObject, eventdata, handles)
172 % hObject handle to pushbutton_OK (see GCBO)
173 % eventdata reserved - to be defined in a future version of MATLAB
174 % handles structure with handles and user data (see GUIDATA)
175
176 delete(gcf);