function varargout = speechrecognition(varargin)
% SPEECHRECOGNITION MATLAB code for speechrecognition.fig
% SPEECHRECOGNITION, by itself, creates a new SPEECHRECOGNITION or raises the existing
% singleton*.
%
% H = SPEECHRECOGNITION returns the handle to a new SPEECHRECOGNITION or the handle to
% the existing singleton*.
%
% SPEECHRECOGNITION('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in SPEECHRECOGNITION.M with the given input arguments.
%
% SPEECHRECOGNITION('Property','Value',...) creates a new SPEECHRECOGNITION or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before speechrecognition_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to speechrecognition_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 speechrecognition
% Last Modified by GUIDE v2.5 02-Jun-2018 19:49:50
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @speechrecognition_OpeningFcn, ...
'gui_OutputFcn', @speechrecognition_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 speechrecognition is made visible.
function speechrecognition_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 speechrecognition (see VARARGIN)
% Choose default command line output for speechrecognition
global sc Fs1 t1 myRecording3 t2 Nmn Nm name1 j ii name2 mode55 mode44
mode55=0;
mode44=0;
ii=1;
if isempty(get(handles.edit3,'string'))
name1=cell(10);
name2=cell(10);
else
name1=cell(1,str2double(get(handles.edit3,'string')));
name2=cell(1,str2double(get(handles.edit3,'string')));
end
j=1;
sc='';
set(handles.listbox1,'string',num2str(sc),'fontsize',10);
handles.output = hObject;
A='请设置需要进行语音识别和训练的参数:';
B='设置完成请点击开始按钮进行语音识别模板库的录音:';
C='请注意以下几点:';
D='①可以自定义模板库:需要数量与设置的数量一致;';
E='②注意模板文件的录音间隔为3秒;';
F='③录取过程中如果出错需要全部重新录取,因此尽量不要出错;';
G='④自定义的文件需要保存在当前目录的设置的文件夹下面,比如:njh+数字.wav的形式。';
sc=[sc,A,10];
sc=[sc,B,10];
sc=[sc,C,10];
sc=[sc,D,10];
sc=[sc,E,10];
sc=[sc,F,10];
sc=[sc,G,10];
set(handles.listbox1,'string',num2str(sc),'fontsize',10,'fontname','KaiTi');
h = handles.figure1; %返回其句柄
newIcon = javax.swing.ImageIcon('iconcumt.jpg');
figFrame = get(h,'JavaFrame'); %取得Figure的JavaFrame。
figFrame.setFigureIcon(newIcon);
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes speechrecognition wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = speechrecognition_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 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
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global sc Fs1 t1 myRecording3 t2 Nmn Nm name1 j ii name2
t2=str2double(get(handles.edit5,'string'));
Fs1=16000;
n=1;
recObj = audiorecorder(Fs1,16,n);
start='开始录取待识别语音';
set(handles.edit6,'string',num2str(start));
recordblocking(recObj, t2); %保存5秒
set(handles.edit6,'string','');
end1='结束录音';
set(handles.edit6,'string',num2str(end1));
myRecording3 = getaudiodata(recObj);
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global sc Fs1 t1 myRecording3 t2 Nmn Nm name1 j ii name2
Nmn=str2double(get(handles.edit2,'string'));
Nm=str2double(get(handles.edit3,'string'));
t1=str2double(get(handles.edit4,'string'));
t2=str2double(get(handles.edit5,'string'));
Fs1=16000;
ncoeff = 12; %MFCC参数阶数
N = Nmn; %10个数字
fs=Fs1; %采样频率
k = Nm; %训练样本的人数
speechIn3=myRecording3;
speechIn3 = my_vad(speechIn3); %端点检测
rMatrix1 = mfccf(ncoeff,speechIn3,fs); %采用MFCC系数作为特征矢量
rMatrix = CMN(rMatrix1); %归一化处理
axes(handles.axes1);
plot(speechIn3);
namen1='待识别的语音';
set(handles.text2,'string',num2str(namen1));
Sco = DTWScores(rMatrix,Nmn,Nm) ; %计算DTW值
[SortedScores,EIndex] = sort(Sco,2); %按行递增排序,并返回对应的原始次序
Nbr = EIndex(:,1:2); %得到每个模板匹配的2个最低值对应的次序
[Modal,Freq] = mode(Nbr(:)); %返回出现频率最高的数Modal及其出现频率Freq
Word = char('0','1','2','3','4','5','6','7','8','9','中','国','矿','业','大','学','信','控','学','院');
if mean(abs(speechIn3)) < 0.01
TT='识别结果为:';
DD='没有麦克风连接,或者你什么都没说。';
sc=[sc,TT,10];
sc=[sc,DD,10];
set(handles.listbox1,'string',num2str(sc),'fontsize',10,'fontname','KaiTi');
elseif (Freq <2) %频率太低不确定
TT='识别结果为:';
FF='你所说的话不能被正确地认识。';
sc=[sc,TT,10];
sc=[sc,FF,10];
set(handles.listbox1,'string',num2str(sc),'fontsize',10,'fontname','KaiTi');
else
TT='识别结果为:';
GG=['识别结果',Word(Modal,:)];
sc=[sc,TT,10];
sc=[sc,GG,10];
set(handles.listbox1,'string',num2str(sc),'fontsize',10,'fontname','KaiTi');
end
% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
语音识别.zip (86个子文件)
mfccf.m 2KB
baum_welch.m 2KB
mel2freq.m 134B
Vectors2.mat 1.03MB
speechrecognition.m 23KB
getparam.m 2KB
deltacoeff.m 234B
inithmm.m 1KB
njh
11.wav 63KB
20.wav 63KB
1.wav 63KB
7.wav 63KB
18.wav 63KB
3.wav 63KB
17.wav 63KB
5.wav 63KB
8.wav 63KB
14.wav 63KB
6.wav 63KB
4.wav 63KB
16.wav 63KB
10.wav 63KB
19.wav 63KB
15.wav 63KB
13.wav 63KB
9.wav 63KB
12.wav 63KB
2.wav 63KB
DTWScores.m 670B
freq2mel.m 132B
speechrecognition.fig 52KB
vad.m 2KB
iconcumt.jpg 15KB
melbankm.m 819B
enframe.m 375B
my_vad.m 4KB
mfcc.m 858B
viterbi.m 959B
myDTW.m 699B
kk
11.wav 63KB
20.wav 63KB
1.wav 63KB
7.wav 63KB
18.wav 63KB
3.wav 63KB
17.wav 63KB
5.wav 63KB
8.wav 63KB
14.wav 63KB
6.wav 63KB
4.wav 63KB
16.wav 63KB
10.wav 63KB
19.wav 63KB
15.wav 63KB
13.wav 63KB
9.wav 63KB
12.wav 63KB
2.wav 63KB
Vectors3.mat 1.03MB
mixture.m 516B
disteusq.m 2KB
CMN.m 185B
kmeans1.m 2KB
lcg
11.wav 63KB
20.wav 63KB
1.wav 63KB
7.wav 63KB
18.wav 63KB
3.wav 63KB
17.wav 63KB
5.wav 63KB
8.wav 63KB
14.wav 63KB
6.wav 63KB
4.wav 63KB
16.wav 63KB
10.wav 63KB
19.wav 63KB
15.wav 63KB
13.wav 63KB
9.wav 63KB
12.wav 63KB
2.wav 63KB
Vectors1.mat 1.03MB
melbankm2.m 3KB
共 86 条
- 1
资源评论
- 根号二十三2018-12-13啊上的大事大大
- bit_maomao2021-06-01能运行。还不错,比大部分资源好一点
GreatNJH
- 粉丝: 10
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功