function varargout = fenxi(varargin)
% FENXI M-file for fenxi.fig
% FENXI, by itself, creates a new FENXI or raises the existing
% singleton*.
%
% H = FENXI returns the handle to a new FENXI or the handle to
% the existing singleton*.
%
% FENXI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in FENXI.M with the given input arguments.
%
% FENXI('Property','Value',...) creates a new FENXI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before fenxi_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to fenxi_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help fenxi
% Last Modified by GUIDE v2.5 16-Apr-2011 10:34:16
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @fenxi_OpeningFcn, ...
'gui_OutputFcn', @fenxi_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before fenxi is made visible.
function fenxi_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to fenxi (see VARARGIN)
% Choose default command line output for fenxi
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes fenxi wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = fenxi_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in luyin.
function luyin_Callback(hObject, eventdata, handles)
% hObject handle to luyin (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if get(hObject,'Value')
set(handles.luyinpinlv,'Enable','on');
set(handles.dakai,'Value',0);
set(handles.luyinshijian,'Enable','on');
set(handles.luyinqueding,'Enable','on');
set(handles.dakaiqueding,'Enable','off');
set(handles.bofang,'Value',0);
set(handles.bofangpinlv,'Enable','off');
set(handles.bofangqueding,'Enable','off');
set(handles.luyinqueding,'string','开始');
else
end;
% Hint: get(hObject,'Value') returns toggle state of luyin
% --- Executes on button press in dakai.
function dakai_Callback(hObject, eventdata, handles)
% hObject handle to dakai (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if get(hObject,'Value')
set(handles.luyin,'Value',0);
set(handles.luyinshijian,'Enable','off');
set(handles.luyinqueding,'Enable','off');
set(handles.dakaiqueding,'Enable','on');
set(handles.bofang,'Value',0);
set(handles.bofangpinlv,'Enable','off');
set(handles.bofangqueding,'Enable','off');
set(handles.luyinpinlv,'Enable','off');
else
end;
% Hint: get(hObject,'Value') returns toggle state of dakai
% --- Executes on button press in radiobutton3.
function radiobutton3_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton3
% --- Executes on button press in luyinqueding.
function luyinqueding_Callback(hObject, eventdata, handles)
% hObject handle to luyinqueding (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(hObject,'string','录音中');
pause(0.4);
Fs=str2double(get(handles.luyinpinlv,'String'));
t=str2double(get(handles.luyinshijian,'String'));
ai=analoginput('winsound',0);%初始化录音麦克
chanel=addchannel(ai,1);%1表示单声道
set(ai,'SampleRate',Fs);
duration=t; %录音时间
set(ai,'SamplesPerTrigger',duration*Fs);
start(ai);
y=0;time=0;
[y,time]=getdata(ai);%读出相应的数据
handles.y=y;
handles.Fs=Fs;
guidata(hObject,handles);
plot(handles.huitu2,time,handles.y)%画出声音波形
title(handles.huitu2,'时域图');
ysize=size(handles.y);
set(hObject,'string','完毕');
set(handles.yuchuli,'Enable','on');
set(handles.yuchuliqd,'Enable','on');
set(handles.fuliyebianhuan,'Enable','on');
set(handles.baocun,'Enable','on');
set(handles.biansheng,'Enable','on');
% --- Executes on button press in dakaiqueding.
function dakaiqueding_Callback(hObject, eventdata, handles)
% hObject handle to dakaiqueding (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename pathname]=uigetfile({'*.wav','ALL FILES(*.*)'},'选择声音文件');
if isequal([filename pathname],[0,0])
return;
end
str=[pathname filename];%选择的声音文件路径和文件名
[temp Fs]=wavread(str);%temp表示声音数据 Fs表示频率
handles.y=temp;handles.Fs=Fs;
handles.xuanze=2;
guidata(hObject,handles);
set(handles.yuchuli,'Enable','on');
set(handles.yuchuliqd,'Enable','on');
set(handles.fuliyebianhuan,'Enable','on');
set(handles.baocun,'Enable','on');
set(handles.biansheng,'Enable','on');
set(handles.bofang,'Enable','on');
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
function luyinshijian_Callback(hObject, eventdata, handles)
% hObject handle to luyinshijian (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of luyinshijian as text
% str2double(get(hObject,'String')) returns contents of luyinshijian as a double
% --- Executes during object creation, after setting all properties.
function luyinshijian_CreateFcn(hObject, eventdata, handles)
% hObject handle to luyinshijian (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in bofang.
function bofang_Callback(hObject, eventdata, handles)
% hObject handle to bofang (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if get(hObject,'Value')
set(handles.luyin,'Value',0);
- 1
- 2
- 3
- 4
- 5
- 6
前往页