Dawn@4: function varargout = vs_Settings_Praat(varargin) Dawn@4: % VS_SETTINGS_PRAAT M-file for vs_Settings_Praat.fig Dawn@4: % VS_SETTINGS_PRAAT, by itself, creates a new VS_SETTINGS_PRAAT or raises the existing Dawn@4: % singleton*. Dawn@4: % Dawn@4: % H = VS_SETTINGS_PRAAT returns the handle to a new VS_SETTINGS_PRAAT or the handle to Dawn@4: % the existing singleton*. Dawn@4: % Dawn@4: % VS_SETTINGS_PRAAT('CALLBACK',hObject,eventData,handles,...) calls the local Dawn@4: % function named CALLBACK in VS_SETTINGS_PRAAT.M with the given input arguments. Dawn@4: % Dawn@4: % VS_SETTINGS_PRAAT('Property','Value',...) creates a new VS_SETTINGS_PRAAT or raises the Dawn@4: % existing singleton*. Starting from the left, property value pairs are Dawn@4: % applied to the GUI before vs_Settings_Praat_OpeningFcn gets called. An Dawn@4: % unrecognized property name or invalid value makes property application Dawn@4: % stop. All inputs are passed to vs_Settings_Praat_OpeningFcn via varargin. Dawn@4: % Dawn@4: % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one Dawn@4: % instance to run (singleton)". Dawn@4: % Dawn@4: % See also: GUIDE, GUIDATA, GUIHANDLES Dawn@4: Dawn@4: % Edit the above text to modify the response to help vs_Settings_Praat Dawn@4: Dawn@4: % Last Modified by GUIDE v2.5 08-Mar-2011 23:30:28 Dawn@4: Dawn@4: % Begin initialization code - DO NOT EDIT Dawn@4: gui_Singleton = 1; Dawn@4: gui_State = struct('gui_Name', mfilename, ... Dawn@4: 'gui_Singleton', gui_Singleton, ... Dawn@4: 'gui_OpeningFcn', @vs_Settings_Praat_OpeningFcn, ... Dawn@4: 'gui_OutputFcn', @vs_Settings_Praat_OutputFcn, ... Dawn@4: 'gui_LayoutFcn', [] , ... Dawn@4: 'gui_Callback', []); Dawn@4: if nargin && ischar(varargin{1}) Dawn@4: gui_State.gui_Callback = str2func(varargin{1}); Dawn@4: end Dawn@4: Dawn@4: if nargout Dawn@4: [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); Dawn@4: else Dawn@4: gui_mainfcn(gui_State, varargin{:}); Dawn@4: end Dawn@4: % End initialization code - DO NOT EDIT Dawn@4: Dawn@4: Dawn@4: % --- Executes just before vs_Settings_Praat is made visible. Dawn@4: function vs_Settings_Praat_OpeningFcn(hObject, eventdata, handles, varargin) Dawn@4: % This function has no output args, see OutputFcn. Dawn@4: % hObject handle to figure Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: % varargin command line arguments to vs_Settings_Praat (see VARARGIN) Dawn@4: Dawn@4: % Choose default command line output for vs_Settings_Praat Dawn@4: handles.output = hObject; Dawn@4: Dawn@4: Setfig = vs_Settings; Dawn@4: Sethandle = guidata(Setfig); Dawn@4: handles.Setfig = Setfig; Dawn@4: handles.Sethandle = Sethandle; Dawn@4: handles.VSHandle = Sethandle.VSHandle; Dawn@4: Dawn@4: setGUIVariables(handles); Dawn@4: Dawn@4: % Update handles structure Dawn@4: guidata(hObject, handles); Dawn@4: Dawn@4: % UIWAIT makes vs_Settings_Praat wait for user response (see UIRESUME) Dawn@4: % uiwait(handles.figure1); Dawn@4: Dawn@4: Dawn@4: % align the variables with those in VS.vars Dawn@4: function setGUIVariables(handles) Dawn@4: VSData = guidata(handles.VSHandle); Dawn@4: vars = VSData.vars; Dawn@4: Dawn@4: set(handles.edit_max_F0, 'String', num2str(vars.F0Praatmax)); Dawn@4: set(handles.edit_min_F0, 'String', num2str(vars.F0Praatmin)); Dawn@4: Dawn@4: set(handles.edit_voice_threshold, 'String', num2str(vars.F0PraatVoiceThreshold)); Dawn@4: set(handles.edit_silence_threshold, 'String', num2str(vars.F0PraatSilenceThreshold)); Dawn@4: set(handles.edit_octave_cost, 'String', num2str(vars.F0PraatOctaveCost)); Dawn@4: set(handles.edit_oct_j_cost, 'String', num2str(vars.F0PraatOctiveJumpCost)); Dawn@4: set(handles.edit_voiced_unvoiced_cost, 'String', num2str(vars.F0PraatVoicedUnvoicedCost)); Dawn@4: set(handles.edit_smoothing_bandwidth, 'String', num2str(vars.F0PraatSmoothingBandwidth)); Dawn@4: Dawn@4: set(handles.checkbox_kill_octave_jumps, 'Value', vars.F0PraatKillOctaveJumps); Dawn@4: set(handles.checkbox_smooth, 'Value', vars.F0PraatSmooth); Dawn@4: set(handles.checkbox_interpolate, 'Value', vars.F0PraatInterpolate); Dawn@4: Dawn@4: Dawn@4: % --- Outputs from this function are returned to the command line. Dawn@4: function varargout = vs_Settings_Praat_OutputFcn(hObject, eventdata, handles) Dawn@4: % varargout cell array for returning output args (see VARARGOUT); Dawn@4: % hObject handle to figure Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: Dawn@4: % Get default command line output from handles structure Dawn@4: varargout{1} = handles.output; Dawn@4: Dawn@4: Dawn@4: Dawn@4: function edit_min_F0_Callback(hObject, eventdata, handles) Dawn@4: % hObject handle to edit_min_F0 (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: Dawn@4: % Hints: get(hObject,'String') returns contents of edit_min_F0 as text Dawn@4: % str2double(get(hObject,'String')) returns contents of edit_min_F0 as a double Dawn@4: VSData = guidata(handles.VSHandle); Dawn@4: val = str2double(get(hObject, 'String')); Dawn@4: Dawn@4: if (~isnan(val) && val >= 0) Dawn@4: VSData.vars.F0Praatmin = val; Dawn@4: guidata(handles.VSHandle, VSData); Dawn@4: set(hObject, 'String', num2str(val)); Dawn@4: else Dawn@4: set(hObject, 'String', num2str(VSData.vars.F0Praatmin)); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: Dawn@4: % --- Executes during object creation, after setting all properties. Dawn@4: function edit_min_F0_CreateFcn(hObject, eventdata, handles) Dawn@4: % hObject handle to edit_min_F0 (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles empty - handles not created until after all CreateFcns called Dawn@4: Dawn@4: % Hint: edit controls usually have a white background on Windows. Dawn@4: % See ISPC and COMPUTER. Dawn@4: if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) Dawn@4: set(hObject,'BackgroundColor','white'); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: Dawn@4: function edit_max_F0_Callback(hObject, eventdata, handles) Dawn@4: % hObject handle to edit_max_F0 (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: Dawn@4: % Hints: get(hObject,'String') returns contents of edit_max_F0 as text Dawn@4: % str2double(get(hObject,'String')) returns contents of edit_max_F0 as a double Dawn@4: VSData = guidata(handles.VSHandle); Dawn@4: val = str2double(get(hObject, 'String')); Dawn@4: Dawn@4: if (~isnan(val) && val >= 0) Dawn@4: VSData.vars.F0Praatmax = val; Dawn@4: guidata(handles.VSHandle, VSData); Dawn@4: set(hObject, 'String', num2str(val)); Dawn@4: else Dawn@4: set(hObject, 'String', num2str(VSData.vars.F0Praatmax)); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: Dawn@4: Dawn@4: % --- Executes during object creation, after setting all properties. Dawn@4: function edit_max_F0_CreateFcn(hObject, eventdata, handles) Dawn@4: % hObject handle to edit_max_F0 (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles empty - handles not created until after all CreateFcns called Dawn@4: Dawn@4: % Hint: edit controls usually have a white background on Windows. Dawn@4: % See ISPC and COMPUTER. Dawn@4: if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) Dawn@4: set(hObject,'BackgroundColor','white'); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: Dawn@4: function edit_voice_threshold_Callback(hObject, eventdata, handles) Dawn@4: % hObject handle to edit_voice_threshold (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: Dawn@4: % Hints: get(hObject,'String') returns contents of edit_voice_threshold as text Dawn@4: % str2double(get(hObject,'String')) returns contents of edit_voice_threshold as a double Dawn@4: VSData = guidata(handles.VSHandle); Dawn@4: val = str2double(get(hObject, 'String')); Dawn@4: Dawn@4: if (~isnan(val) && val >= 0) Dawn@4: VSData.vars.F0PraatVoiceThreshold = val; Dawn@4: guidata(handles.VSHandle, VSData); Dawn@4: set(hObject, 'String', num2str(val)); Dawn@4: else Dawn@4: set(hObject, 'String', num2str(VSData.vars.F0PraatVoiceThreshold)); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: % --- Executes during object creation, after setting all properties. Dawn@4: function edit_voice_threshold_CreateFcn(hObject, eventdata, handles) Dawn@4: % hObject handle to edit_voice_threshold (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles empty - handles not created until after all CreateFcns called Dawn@4: Dawn@4: % Hint: edit controls usually have a white background on Windows. Dawn@4: % See ISPC and COMPUTER. Dawn@4: if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) Dawn@4: set(hObject,'BackgroundColor','white'); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: Dawn@4: function edit_oct_j_cost_Callback(hObject, eventdata, handles) Dawn@4: % hObject handle to edit_oct_j_cost (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: Dawn@4: % Hints: get(hObject,'String') returns contents of edit_oct_j_cost as text Dawn@4: % str2double(get(hObject,'String')) returns contents of edit_oct_j_cost as a double Dawn@4: VSData = guidata(handles.VSHandle); Dawn@4: val = str2double(get(hObject, 'String')); Dawn@4: Dawn@4: if (~isnan(val) && val >= 0) Dawn@4: VSData.vars.F0PraatOctiveJumpCost = val; Dawn@4: guidata(handles.VSHandle, VSData); Dawn@4: set(hObject, 'String', num2str(val)); Dawn@4: else Dawn@4: set(hObject, 'String', num2str(VSData.vars.F0PraatOctiveJumpCost)); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: % --- Executes during object creation, after setting all properties. Dawn@4: function edit_oct_j_cost_CreateFcn(hObject, eventdata, handles) Dawn@4: % hObject handle to edit_oct_j_cost (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles empty - handles not created until after all CreateFcns called Dawn@4: Dawn@4: % Hint: edit controls usually have a white background on Windows. Dawn@4: % See ISPC and COMPUTER. Dawn@4: if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) Dawn@4: set(hObject,'BackgroundColor','white'); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: % --- Executes on button press in pushbutton_OK. Dawn@4: function pushbutton_OK_Callback(hObject, eventdata, handles) Dawn@4: % hObject handle to pushbutton_OK (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: Dawn@4: delete(gcf); Dawn@4: Dawn@4: Dawn@4: % --- Executes on button press in checkbox_kill_octave_jumps. Dawn@4: function checkbox_kill_octave_jumps_Callback(hObject, eventdata, handles) Dawn@4: % hObject handle to checkbox_kill_octave_jumps (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: Dawn@4: % Hint: get(hObject,'Value') returns toggle state of checkbox_kill_octave_jumps Dawn@4: VSData = guidata(handles.VSHandle); Dawn@4: VSData.vars.F0PraatKillOctaveJumps = get(hObject, 'Value'); Dawn@4: guidata(handles.VSHandle, VSData); Dawn@4: Dawn@4: Dawn@4: % --- Executes on button press in checkbox_smooth. Dawn@4: function checkbox_smooth_Callback(hObject, eventdata, handles) Dawn@4: % hObject handle to checkbox_smooth (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: Dawn@4: % Hint: get(hObject,'Value') returns toggle state of checkbox_smooth Dawn@4: VSData = guidata(handles.VSHandle); Dawn@4: VSData.vars.F0PraatSmooth = get(hObject, 'Value'); Dawn@4: guidata(handles.VSHandle, VSData); Dawn@4: Dawn@4: Dawn@4: % --- Executes on button press in checkbox_interpolate. Dawn@4: function checkbox_interpolate_Callback(hObject, eventdata, handles) Dawn@4: % hObject handle to checkbox_interpolate (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: Dawn@4: % Hint: get(hObject,'Value') returns toggle state of checkbox_interpolate Dawn@4: VSData = guidata(handles.VSHandle); Dawn@4: VSData.vars.F0PraatInterpolate = get(hObject, 'Value'); Dawn@4: guidata(handles.VSHandle, VSData); Dawn@4: Dawn@4: Dawn@4: Dawn@4: function edit_silence_threshold_Callback(hObject, eventdata, handles) Dawn@4: % hObject handle to edit_silence_threshold (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: Dawn@4: % Hints: get(hObject,'String') returns contents of edit_silence_threshold as text Dawn@4: % str2double(get(hObject,'String')) returns contents of edit_silence_threshold as a double Dawn@4: VSData = guidata(handles.VSHandle); Dawn@4: val = str2double(get(hObject, 'String')); Dawn@4: Dawn@4: if (~isnan(val) && val >= 0) Dawn@4: VSData.vars.F0PraatSilenceThreshold = val; Dawn@4: guidata(handles.VSHandle, VSData); Dawn@4: set(hObject, 'String', num2str(val)); Dawn@4: else Dawn@4: set(hObject, 'String', num2str(VSData.vars.F0PraatSilenceThreshold)); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: % --- Executes during object creation, after setting all properties. Dawn@4: function edit_silence_threshold_CreateFcn(hObject, eventdata, handles) Dawn@4: % hObject handle to edit_silence_threshold (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles empty - handles not created until after all CreateFcns called Dawn@4: Dawn@4: % Hint: edit controls usually have a white background on Windows. Dawn@4: % See ISPC and COMPUTER. Dawn@4: if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) Dawn@4: set(hObject,'BackgroundColor','white'); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: Dawn@4: function edit_octave_cost_Callback(hObject, eventdata, handles) Dawn@4: % hObject handle to edit_octave_cost (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: Dawn@4: % Hints: get(hObject,'String') returns contents of edit_octave_cost as text Dawn@4: % str2double(get(hObject,'String')) returns contents of edit_octave_cost as a double Dawn@4: VSData = guidata(handles.VSHandle); Dawn@4: val = str2double(get(hObject, 'String')); Dawn@4: Dawn@4: if (~isnan(val) && val >= 0) Dawn@4: VSData.vars.F0PraatOctaveCost = val; Dawn@4: guidata(handles.VSHandle, VSData); Dawn@4: set(hObject, 'String', num2str(val)); Dawn@4: else Dawn@4: set(hObject, 'String', num2str(VSData.vars.F0PraatOctaveCost)); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: % --- Executes during object creation, after setting all properties. Dawn@4: function edit_octave_cost_CreateFcn(hObject, eventdata, handles) Dawn@4: % hObject handle to edit_octave_cost (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles empty - handles not created until after all CreateFcns called Dawn@4: Dawn@4: % Hint: edit controls usually have a white background on Windows. Dawn@4: % See ISPC and COMPUTER. Dawn@4: if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) Dawn@4: set(hObject,'BackgroundColor','white'); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: Dawn@4: function edit_voiced_unvoiced_cost_Callback(hObject, eventdata, handles) Dawn@4: % hObject handle to edit_voiced_unvoiced_cost (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: Dawn@4: % Hints: get(hObject,'String') returns contents of edit_voiced_unvoiced_cost as text Dawn@4: % str2double(get(hObject,'String')) returns contents of edit_voiced_unvoiced_cost as a double Dawn@4: VSData = guidata(handles.VSHandle); Dawn@4: val = str2double(get(hObject, 'String')); Dawn@4: Dawn@4: if (~isnan(val) && val >= 0) Dawn@4: VSData.vars.F0PraatVoicedUnvoicedCost = val; Dawn@4: guidata(handles.VSHandle, VSData); Dawn@4: set(hObject, 'String', num2str(val)); Dawn@4: else Dawn@4: set(hObject, 'String', num2str(VSData.vars.F0PraatVoicedUnvoicedCost)); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: % --- Executes during object creation, after setting all properties. Dawn@4: function edit_voiced_unvoiced_cost_CreateFcn(hObject, eventdata, handles) Dawn@4: % hObject handle to edit_voiced_unvoiced_cost (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles empty - handles not created until after all CreateFcns called Dawn@4: Dawn@4: % Hint: edit controls usually have a white background on Windows. Dawn@4: % See ISPC and COMPUTER. Dawn@4: if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) Dawn@4: set(hObject,'BackgroundColor','white'); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: Dawn@4: function edit_smoothing_bandwidth_Callback(hObject, eventdata, handles) Dawn@4: % hObject handle to edit_smoothing_bandwidth (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles structure with handles and user data (see GUIDATA) Dawn@4: Dawn@4: % Hints: get(hObject,'String') returns contents of edit_smoothing_bandwidth as text Dawn@4: % str2double(get(hObject,'String')) returns contents of edit_smoothing_bandwidth as a double Dawn@4: VSData = guidata(handles.VSHandle); Dawn@4: val = str2double(get(hObject, 'String')); Dawn@4: Dawn@4: if (~isnan(val) && val >= 0) Dawn@4: VSData.vars.F0PraatSmoothingBandwidth = val; Dawn@4: guidata(handles.VSHandle, VSData); Dawn@4: set(hObject, 'String', num2str(val)); Dawn@4: else Dawn@4: set(hObject, 'String', num2str(VSData.vars.F0PraatSmoothingBandwidth)); Dawn@4: end Dawn@4: Dawn@4: Dawn@4: % --- Executes during object creation, after setting all properties. Dawn@4: function edit_smoothing_bandwidth_CreateFcn(hObject, eventdata, handles) Dawn@4: % hObject handle to edit_smoothing_bandwidth (see GCBO) Dawn@4: % eventdata reserved - to be defined in a future version of MATLAB Dawn@4: % handles empty - handles not created until after all CreateFcns called Dawn@4: Dawn@4: % Hint: edit controls usually have a white background on Windows. Dawn@4: % See ISPC and COMPUTER. Dawn@4: if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) Dawn@4: set(hObject,'BackgroundColor','white'); Dawn@4: end