您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 信息化管理 > 区分男女声matlab代码
functionvarargout=boy_girl(varargin)%BOY_GIRLM-fileforboy_girl.fig%BOY_GIRL,byitself,createsanewBOY_GIRLorraisestheexisting%singleton*.%%H=BOY_GIRLreturnsthehandletoanewBOY_GIRLorthehandleto%theexistingsingleton*.%%BOY_GIRL('CALLBACK',hObject,eventData,handles,...)callsthelocal%functionnamedCALLBACKinBOY_GIRL.Mwiththegiveninputarguments.%%BOY_GIRL('Property','Value',...)createsanewBOY_GIRLorraisesthe%existingsingleton*.Startingfromtheleft,propertyvaluepairsare%appliedtotheGUIbeforeboy_girl_OpeningFcngetscalled.An%unrecognizedpropertynameorinvalidvaluemakespropertyapplication%stop.Allinputsarepassedtoboy_girl_OpeningFcnviavarargin.%%*SeeGUIOptionsonGUIDE'sToolsmenu.ChooseGUIallowsonlyone%instancetorun(singleton).%%Seealso:GUIDE,GUIDATA,GUIHANDLES%Edittheabovetexttomodifytheresponsetohelpboy_girl%LastModifiedbyGUIDEv2.507-May-201112:11:56%Begininitializationcode-DONOTEDITgui_Singleton=1;gui_State=struct('gui_Name',mfilename,...'gui_Singleton',gui_Singleton,...'gui_OpeningFcn',@boy_girl_OpeningFcn,...'gui_OutputFcn',@boy_girl_OutputFcn,...'gui_LayoutFcn',[],...'gui_Callback',[]);ifnargin&&ischar(varargin{1})gui_State.gui_Callback=str2func(varargin{1});endifnargout[varargout{1:nargout}]=gui_mainfcn(gui_State,varargin{:});elsegui_mainfcn(gui_State,varargin{:});end%Endinitializationcode-DONOTEDIT%---Executesjustbeforeboy_girlismadevisible.functionboy_girl_OpeningFcn(hObject,~,handles,varargin)%Thisfunctionhasnooutputargs,seeOutputFcn.%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%varargincommandlineargumentstoboy_girl(seeVARARGIN)%Choosedefaultcommandlineoutputforboy_girlhandles.output=hObject;%Updatehandlesstructureguidata(hObject,handles);%UIWAITmakesboy_girlwaitforuserresponse(seeUIRESUME)%uiwait(handles.figure1);%---Outputsfromthisfunctionarereturnedtothecommandline.functionvarargout=boy_girl_OutputFcn(~,~,handles)%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)set(handles.time_edit,'string','10');set(handles.freq_edit,'string','8000');%Getdefaultcommandlineoutputfromhandlesstructureoriginalvarargout{1}=handles.output;functiontime_edit_Callback(~,~,~)%hObjecthandletotime_edit(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Hints:get(hObject,'String')returnscontentsoftime_editastext%str2double(get(hObject,'String'))returnscontentsoftime_editasadouble%---Executesduringobjectcreation,aftersettingallproperties.functiontime_edit_CreateFcn(hObject,~,~)%hObjecthandletotime_edit(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled%Hint:editcontrolsusuallyhaveawhitebackgroundonWindows.%SeeISPCandCOMPUTER.ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');endfunctionfreq_edit_Callback(~,eventdata,handles)%hObjecthandletofreq_edit(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Hints:get(hObject,'String')returnscontentsoffreq_editastext%str2double(get(hObject,'String'))returnscontentsoffreq_editasadouble%---Executesduringobjectcreation,aftersettingallproperties.functionfreq_edit_CreateFcn(hObject,~,~)%hObjecthandletofreq_edit(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled%Hint:editcontrolsusuallyhaveawhitebackgroundonWindows.%SeeISPCandCOMPUTER.ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');end%---Executesonbuttonpressinstart_pushbutton.functionstart_pushbutton_Callback(hObject,~,handles)%hObjecthandletostart_pushbutton(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)freq=str2num(get(handles.freq_edit,'String'));time=str2num(get(handles.time_edit,'string'));ai=analoginput('winsound',0);%初始化录音麦克chanel=addchannel(ai,1);%1表示单声道set(ai,'SampleRate',freq);T=time;%录音时间set(ai,'SamplesPerTrigger',T*freq);start(ai);y=0;time=0;[y,time]=getdata(ai);%读出相应的数据handles.y=y;handles.Fs=freq;handles.yoriginal=y;handles.foriginal=freq;guidata(hObject,handles);plot(handles.axes1,time,handles.y)%画出声音波形title(handles.axes1,'时域图');xlabel(handles.axes1,'时间');ylabel(handles.axes1,'频率');set(handles.axes1,'Xgrid','on');set(handles.axes1,'Ygrid','on');%---Executesonselectionchangeinxuanpin_popupmenu.functionxuanpin_popupmenu_Callback(hObject,eventdata,handles)%hObjecthandletoxuanpin_popupmenu(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)contents=cellstr(get(handles.xuanpin_popupmenu,'String'));%获取listbox1中的细胞矩阵item=contents{get(handles.xuanpin_popupmenu,'Value')};%获取listbox中的值ifstrc
本文标题:区分男女声matlab代码
链接地址:https://www.777doc.com/doc-5806354 .html