function varargout = HMM_VoiceRecognation(varargin)
% HMM_VOICERECOGNATION MATLAB code for HMM_VoiceRecognation.fig
% HMM_VOICERECOGNATION, by itself, creates a new HMM_VOICERECOGNATION or raises the existing
% singleton*.
%
% H = HMM_VOICERECOGNATION returns the handle to a new HMM_VOICERECOGNATION or the handle to
% the existing singleton*.
%
% HMM_VOICERECOGNATION('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in HMM_VOICERECOGNATION.M with the given input arguments.
%
% HMM_VOICERECOGNATION('Property','Value',...) creates a new HMM_VOICERECOGNATION or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before HMM_VoiceRecognation_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to HMM_VoiceRecognation_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 HMM_VoiceRecognation
% Last Modified by GUIDE v2.5 06-Jul-2013 19:40:32
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @HMM_VoiceRecognation_OpeningFcn, ...
'gui_OutputFcn', @HMM_VoiceRecognation_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 HMM_VoiceRecognation is made visible.
function HMM_VoiceRecognation_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 HMM_VoiceRecognation (see VARARGIN)
% Choose default command line output for HMM_VoiceRecognation
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes HMM_VoiceRecognation wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = HMM_VoiceRecognation_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 button_choose.
function button_choose_Callback(hObject, eventdata, handles)
% hObject handle to button_choose (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% fname: 返回文件名
% panme: 返回文件路径名
% index: 选择的文件类型
global fname
global pname
[fname, pname, index] = uigetfile( { '*.wav', '选择语音文件'} ) ;
set( handles.button_reco, 'Enable', 'on' )
% --- Executes on button press in button_reco.
function button_reco_Callback(hObject, eventdata, handles)
% hObject handle to button_reco (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fname
global pname
global str
filename = strcat( pname, '\\', fname ) ;
load('hmm.mat')
% 发音
[ y, fs ] = wavread(filename) ;
sound(y, fs) ;
% 识别
x = wavread(filename);
[x1 x2] = vad(x);
m = mfcc(x);
m = m(x1-2:x2-2,:);
for j=1:10
pout(j) = viterbi(hmm{j}, m);
end
[d,result_index] = max(pout);
%在static text里显示结果
if result_index == 10
result_index = result_index - 10 ;
end
str1 =[ '文件',fname, '的识别结果是:', num2str(result_index), 10 ] ;
str = [str, str1] ;
set( handles.edit1, 'string', str )
set( hObject, 'Enable', 'off' )
% --- Executes on button press in button_train.
function button_train_Callback(hObject, eventdata, handles)
% hObject handle to button_train (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
load('samples.mat')
h = waitbar ( 0, 'HMM parameter training process' ) ;
for i=1:length(Samples)
sample=[];
for k=1:length(Samples{i})
sample(k).wave=Samples{i}{k};
sample(k).data=[];
end
hmm{i}=train(sample,[3 3 3 3]);
s = [ 'HMM parameter training process: ', num2str( ceil ( 100*i / length(Samples) ) ), '%' ] ;
waitbar ( i/( length(Samples) ), h, s ) ;
end
pause (0.5)
close(h)
% --- Executes on button press in button_exit.
function button_exit_Callback(hObject, eventdata, handles)
% hObject handle to button_exit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clear all
close
% --- Executes on selection change in listbox1.
function listbox1_Callback(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns listbox1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from listbox1
% --- Executes during object creation, after setting all properties.
function listbox1_CreateFcn(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox 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
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (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 edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (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 button_clear.
function button_clear_Callback(hObject, eventdata, handles)
% hObject handle to button_clear (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set( handles.edit1, 'string', '' )
clear all
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
HMM隐马尔科夫模型源代码.zip (47个子文件)
HMM隐马尔科夫模型
源代码
3.10.4估值问题
AlphaMatrix.xls 24KB
HMM_Backward.m 1010B
HMM_Forward_demo.m 1KB
HMM_Forward.m 957B
3.10.6学习问题
HMM_Forward_Backward.m 2KB
HMM_Backward.m 1010B
HMM_generate.m 919B
HMM_Forward.m 957B
3.10.5解码问题
HMM_Decoding_demo.m 1KB
HMM_Decoding.m 922B
voicebox.zip 570KB
HMM_VoiceRecognation
baum.m 2KB
HMM_VoiceRecognation.m 7KB
getparam.m 2KB
main.m 222B
inithmm.m 1KB
vad.m 2KB
recog.m 318B
mfcc.m 861B
samples.mat 586KB
viterbi.m 1KB
HMM_VoiceRecognation.fig 4KB
pdf.m 233B
train.m 839B
data
train
9a.wav 25KB
1a.wav 33KB
2a.wav 32KB
8a.wav 21KB
5a.wav 34KB
7a.wav 35KB
4a.wav 36KB
6a.wav 36KB
3a.wav 38KB
0a.wav 28KB
test
4b.wav 37KB
8b.wav 21KB
7b.wav 33KB
9b.wav 27KB
6b.wav 35KB
3b.wav 32KB
5b.wav 36KB
1b.wav 31KB
2b.wav 36KB
0b.wav 29KB
mixture.m 389B
hmm.mat 47KB
说明文档.docx 524KB
共 47 条
- 1
资源评论
- yezi11232018-11-21还没看,非常感谢~
- weixin_402101782019-03-10还没看 不过觉得应该还行
- CAPTIAN船长2019-11-13讲的很详细!
- 西木米lyz2019-06-30用于学习指令特性
qq_42262770
- 粉丝: 1
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功