语音识别基于matlab GUI MFCC特征说话人识别系统含Matlab源码 1153期

Posted 紫极神光

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了语音识别基于matlab GUI MFCC特征说话人识别系统含Matlab源码 1153期相关的知识,希望对你有一定的参考价值。

一、简介

基于matlab GUI MFCC特征说话人识别系统

二、源代码

function varargout = untitled(varargin)
% UNTITLED M-file for untitled.fig
%      UNTITLED, by itself, creates a new UNTITLED or raises the existing
%      singleton*.
%
%      H = UNTITLED returns the handle to a new UNTITLED or the handle to
%      the existing singleton*.
%
%      UNTITLED('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in UNTITLED.M with the given input arguments.
%
%      UNTITLED('Property','Value',...) creates a new UNTITLED or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before untitled_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to untitled_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 untitled

% Last Modified by GUIDE v2.5 21-May-2021 13:54:38

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @untitled_OpeningFcn, ...
                   'gui_OutputFcn',  @untitled_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin & isstr(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 untitled is made visible.
function untitled_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 untitled (see VARARGIN)

% Choose default command line output for untitled
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% This sets up the initial plot - only do when we are invisible
% so window can get raised using untitled.
if strcmp(get(hObject,'Visible'),'off')
    plot(sin(1:0.01:25));    
end


        
axes(handles.axes1);cla;plot(rand(5));
axes(handles.axes3);cla;plot(rand(5));

% UIWAIT makes untitled wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = untitled_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 pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
axes(handles.axes1);
cla;
%plot(rand(5));


% --------------------------------------------------------------------
function FileMenu_Callback(hObject, eventdata, handles)
% hObject    handle to FileMenu (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function OpenMenuItem_Callback(hObject, eventdata, handles)
% hObject    handle to OpenMenuItem (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
file = uigetfile('*.fig');
if ~isequal(file, 0)
    open(file);
end

% --------------------------------------------------------------------
function PrintMenuItem_Callback(hObject, eventdata, handles)
% hObject    handle to PrintMenuItem (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
printdlg(handles.figure1)

% --------------------------------------------------------------------
function CloseMenuItem_Callback(hObject, eventdata, handles)
% hObject    handle to CloseMenuItem (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
selection = questdlg(['Close ' get(handles.figure1,'Name') '?'],...
                     ['Close ' get(handles.figure1,'Name') '...'],...
                     'Yes','No','Yes');
if strcmp(selection,'No')
    return;
end

delete(handles.figure1)


% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

set(hObject, 'String', {'plot(rand(5))', 'plot(sin(1:0.01:25))', 'comet(cos(1:.01:10))', 'bar(1:10)', 'plot(membrane)', 'surf(peaks)'});

% --- Executes on selection change in popupmenu3.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupmenu3 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu3



% --- 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)

n=get(handles.popupmenu2, 'Value');

second=1;%录音时长()
framelnc = 100;%length of Frames excursion
framelen = 256;%length of Frames 采样频率12.500kHz ,桢长为020.5ms
Fs =8000;
pause(2);

message={'录音开始!'};
msgbox(message); 
x= audiorecord(second*Fs, Fs, 'double');
message={'录音结束!'};
msgbox(message);
pause(1);
audioplay(x, Fs);

[x1,x2,amp,zcr]=vad2(x,framelen,framelnc);

axes(handles.axes1);
cla;
%subplot(3,1,1)
plot(x)
axis([1 length(x) -1 1])
line([x1*framelnc x1*framelnc],[-1 1],'color','red');
line([x2*framelnc x2*framelnc],[-1 1],'color','red');
ylabel('归一化的原始信号')
text(x1*framelnc,0.5,'起始端点 \\rightarrow',...
     'HorizontalAlignment','right')
text(x2*framelnc,0.5,'\\leftarrow 结束端点 ',...
     'HorizontalAlignment','left')
 
axes(handles.axes3);
cla;
plot(amp,'b');
hold on;
plot(zcr,'y');
length(amp)
length(zcr)
pmax=max(max(amp),max(zcr));
pmin=min(min(amp),min(zcr));
axis([1 length(amp) 0 pmax])
line([x1 x1],[pmin,pmax],'color','red');
line([x2 x2],[pmin,pmax],'color','red');
ylabel('短时能量(蓝色),过零率(黄色)') 

text(x1,pmax/2,'起始端点 \\rightarrow',...
     'HorizontalAlignment','right')
text(x2,pmax/2,'\\leftarrow 结束端点 ',...
     'HorizontalAlignment','left')

file = sprintf('mytrain\\\\s%d.wav',n);
WAVWRITE(x,Fs,file); 

% --- 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)
%code=train1('mytrain\\',4); 
Fm = 100;%length of Frames excursion
Fn = 256;%length of Frames 采样频率12.500kHz ,桢长为020.5ms
k = 16; % number of centroids required
n=8;
traindir='mytrain\\';

三、运行结果


四、备注

版本:2014a

以上是关于语音识别基于matlab GUI MFCC特征说话人识别系统含Matlab源码 1153期的主要内容,如果未能解决你的问题,请参考以下文章

语音识别基于mfcc特征模板匹配算法实现语音识别matlab源码含GUI

语音识别基于mfcc特征模板匹配算法实现语音识别matlab源码含GUI

语音识别基于mfcc特征模板匹配算法实现声纹识别matlab源码含GUI

语音识别基于mfcc特征模板匹配算法实现声纹识别matlab源码含GUI

语音识别基于matlab GUI智能语音识别门禁系统含Matlab源码 596期

语音识别基于matlab GUI MFCC+VAD端点检测智能语音门禁系统含Matlab源码 451期