基于MATLAB-GUI语音信号的采集分析系统.doc
《基于MATLAB-GUI语音信号的采集分析系统.doc》由会员分享,可在线阅读,更多相关《基于MATLAB-GUI语音信号的采集分析系统.doc(17页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、基于的语音信号采集分析系统前一阵子用MATLABGUI做了一个语音信号采集与分析的界面。功能包括录音、播放、时域、频域分析吧。也导入本地文件进行分析。效果如下:源码如下:function varargout = GUI_1(varargin)% GUI_1 MATLAB code for GUI_1.fig% GUI_1, by itself, creates a new GUI_1 or raises the existing% singleton*.% H = GUI_1 returns the handle to a new GUI_1 or the handle to% the exi
2、sting singleton*.% GUI_1('CALLBACK',hObject,eventData,handles,.) calls the local% function named CALLBACK in GUI_1.M with the given input arguments.% GUI_1('Property','Value',.) creates a new GUI_1 or raises the% existing singleton*. Starting from the left, property value pai
3、rs are% applied to the GUI before GUI_1_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to GUI_1_OpeningFcn via varargin.% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one% instance to run (si
4、ngleton)".% See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help GUI_1 % Last Modified by GUIDE v2.5 25-May-2015 20:52:27 % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, . 'gui_Singleton',
5、gui_Singleton, . 'gui_OpeningFcn', GUI_1_OpeningFcn, . 'gui_OutputFcn', GUI_1_OutputFcn, . 'gui_LayoutFcn', , . 'gui_Callback', );if nargin && ischar(varargin1) gui_State.gui_Callback = str2func(varargin1);end if nargout varargout1:nargout = gui_mainfcn(gui_St
6、ate, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT % - Executes just before GUI_1 is made visible.function GUI_1_OpeningFcn(hObject, , handles, varargin)% This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - t
7、o be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin command line arguments to GUI_1 (see VARARGIN) % Choose default command line output for GUI_1set(handles.axes_t_m,'visible','off');set(handles.axes_fft_m,'visible'
8、,'off');set(handles.axes_t_w,'visible','off');set(handles.axes_fft_w,'visible','off');global local_yn;local_yn=0;% a=imread('yanda.jpg');% axes(handles.axes_t_m)% image(a);handles.output = hObject;% Update handles structureguidata(hObject, handles);% U
9、IWAIT makes GUI_1 wait for user response (see UIRESUME)% uiwait(handles.figure1); ha=axes('units','normalized','position',0 0 1 1);uistack(ha,'down')II=imread('暖色.JPG');image(II)colormap grayset(ha,'handlevisibility','off','visible',
10、9;off');%- Outputs from this function are returned to the command line. function varargout = GUI_1_OutputFcn(, , 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 structu
11、re with handles and user data (see GUIDATA) % Get default command line output from handles structurevarargout1 = handles.output; % - Executes on button press in pushbutton_luyin.function pushbutton_luyin_Callback(hObject, , handles)% hObject handle to pushbutton_luyin (see GCBO)% eventdata reserved
12、- to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% global recObj;% keyboard;% global sex_flag% switch sex_flag% case 0% set(handles.axes_t_m,'visible','on');% set(handles.axes_fft_m,'visible','on');% set(handles.
13、axes_t_w,'visible','off');% set(handles.axes_fft_w,'visible','off');% case 1% set(handles.axes_t_m,'visible','off');% set(handles.axes_fft_m,'visible','off');% set(handles.axes_t_w,'visible','off');% set(handles.axes_fft
14、_w,'visible','off');% case 2% set(handles.axes_t_m,'visible','off');% set(handles.axes_fft_m,'visible','off');% set(handles.axes_t_w,'visible','off');% set(handles.axes_fft_w,'visible','off');% endglobal local_yn;local_y
15、n=0;fs_chose=handles.fs_chose;nBits=8;nChannels=1;%canshu=fs_chose,nBits,nChannels;if(str2double(get(handles.et_time,'String')=0) %添加str2double 后正常 set(handles.set_time,'String','时间参数输入错误!'); msgbox('认真点好吗亲 输入时间参数先。','错误提示','Icon'); set(handles.set_tim
16、e,'BackgroundColor','red'); pause(1); set(handles.set_time,'BackgroundColor','default'); set(handles.set_time,'String','请输入录音时长');else %cla (handles.axes_t_m,'reset'); % set(handles.axes_t_m,'visible','off'); set(handles.pushbut
17、ton_luyin,'BackgroundColor','green'); set(handles.pushbutton_luyin,'String','正在录音.'); recObj = audiorecorder(fs_chose,nBits,nChannels); disp('Start speaking.') recordblocking(recObj, handles.recor_time); disp('End of Recording.'); set(handles.pushbutto
18、n_luyin,'BackgroundColor','yellow'); set(handles.pushbutton_luyin,'String','录音结束'); %play(recObj); pause(1); %新加代码 加入语音识别-刘帅20150526% myRecording = getaudiodata(recObj);% y1=myRecording; % ù% L=length(y1);% NFFT = 2nextpow2(L); % Next power of 2 from length of y%
19、 Y = fft(y1,NFFT)/L;% % f = fs_chose/2*linspace(0,1,NFFT/2+1);% % keyboard;% a=0;% for i=1:fs_chose/2% % if (2*abs(Y)>0.00015% if 2*abs(Y)>(1e-5)% %if(i=2)% %msgbox('你个','性别提示','Icon');% a=a+1;% end% end% if a>10% msgbox('你个','性别提示','Icon');%
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 基于 MATLAB GUI 语音 信号 采集 分析 系统
限制150内