基于MATLAB的说话人识别系统

基于MATLAB的说话人识别系统

  1. 语音识别的简单介绍

基于MATLAB VQ算法的说话人识别系统,矢量量化起着双重作用。在训练阶段,把每一个说话者所提取的特征参数进行分类,产生不同码字所组成的码本。在识别(匹配)阶段,我们用VQ方法计算平均失真测度(本系统在计算距离d时,采用欧氏距离测度),从而判断说话人是谁。

语音识别系统结构框图如图1所示

图1 语音识别系统结构框图

  1. 语者识别的概念

语者识别就是根据说话人的语音信号来判别说话人的身份。语音是人的自然属性之一,由于说话人发音器官的生理差异以及后天形成的行为差异,每个人的语音都带有强烈的个人色彩,这就使得通过分析语音信号来识别说话人成为可能。用语音来鉴别说话人的身份有着许多独特的优点,如语音是人的固有的特征,不会丢失或遗忘;语音信号的采集方便,系统设备成本低;利用电话网络还可实现远程客户服务等。因此,近几年来,说话人识别越来越多的受到人们的重视。与其他生物识别技术如指纹识别、手形识别等相比较,说话人识别不仅使用方便,而且属于非接触性,容易被用户接受,并且在已有的各种生物特征识别技术中,是唯一可以用作远程验证的识别技术。因此,说话人识别的应用前景非常广泛:今天,说话人识别技术已经关系到多学科的研究领域,不同领域中的进步都对说话人识别的发展做出了贡献。说话人识别技术是集声学、语言学、计算机、信息处理和人工智能等诸多领域的一项综合技术,应用需求将十分广阔。在吃力语音信号的时候如何提取信号中关键的成分尤为重要。语音信号的特征参数的好坏直接导致了辨别的准确性。

  1. 演示分析

我们的功能分为两部分:对已经保存的9个数字的语音进行辨别和实时的判断说话人说的是否为一个数.在前者的实验过程中,先把9个数字的声音保存成wav的格式,放在一个文件夹中,作为一个检测的数据库.然后对检测者实行识别,系统给出提示是哪个数字.

在第二个功能中,实时的录取一段说话人的声音作为模板,提取mfcc特征参数,随后紧接着进行遇着识别,也就是让其他人再说相同的话,看是否是原说话者.

实验过程及具体功能如下

先打开Matlab 使Current Directory为录音及程序所所在的文件夹

再打开文件”enter.m”,点run运行,打开enter界面,点击”进入”按钮进入系统。(注:文件包未封装完毕,目前只能通过此方式打开运行。)(如下图figure1)

figure1

在对数据库中已有的语者进行识别模块:

选择载入语音库语音个数;

点击语音库录制模版进行已存语音信息的提取;

点击录音-test进行现场录音;

点击语者判断进行判断数字,并显示出来。

在实时语者识别模块:

点击实时录制模板上的”录音-train”按钮,是把新语者的声音以wav格式存放在”实时模板”文件夹中, 接着点击”实时录制模板”,把新的模板提取特征值。随后点击实时语者识别模板上的”录音-train”按钮,是把语者的声音以wav格式存放在”测试”文件夹中,再点击”实时语者识别”,在对测得的声音提取特征值的同时,和实时模板进行比对,然后得出是否是实时模板中的语者。另外面板上的播放按钮都是播放相对应左边录取的声音。

想要测量多次,只要接着录音,自动保存,然后程序比对音频就可以。

退出只要点击菜单File/Exit,退出程序。

运行代码

附:GUI程序代码
function varargout = untitled2(varargin)
% UNTITLED2 M-file for untitled2.fig
% UNTITLED2, by itself, creates a new UNTITLED2 or raises the existing
% singleton*.

%
% H = UNTITLED2 returns the handle to a new UNTITLED2 or the handle to
% the existing singleton*.

%
% UNTITLED2(‘CALLBACK’,hObject,eventData,handles,…) calls the local
% function named CALLBACK in UNTITLED2.M with the given input arguments.

%
% UNTITLED2(‘Property’,’Value’,…) creates a new UNTITLED2 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before untitled2_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to untitled2_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

% Copyright 2002-2003 The MathWorks, Inc.

% Edit the above text to modify the response to help untitled2

% Last Modified by GUIDE v2.5 08-Jun-2010 23:58:57
% Begin initialization code – DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name’, mfilename, …

‘gui_Singleton’, gui_Singleton, …

‘gui_OpeningFcn’, @untitled2_OpeningFcn, …

‘gui_OutputFcn’, @untitled2_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 untitled2 is made visible.

function untitled2_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 untitled2 (see VARARGIN)
% Choose default command line output for untitled2
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
axes(findobj(‘tag’,’axes13′));
imshow(‘3.jpg’);
axes(findobj(‘tag’,’axes12′));
imshow(‘1.jpg’);
% UIWAIT makes untitled2 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% — Outputs from this function are returned to the command line.

function varargout = untitled2_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)
Channel_Str=get(handles.popupmenu3,’String’);
Channel_Number=str2double(Channel_Str{get(handles.popupmenu3,’Value’)});
global moodle;
moodle = train(‘模版\’,Channel_Number) %¶Ô´ýÇóÓïÒô½øÐÐÌáÈ¡Âë±¾
% — Executes on button press in pushbutton2.

function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handglobal data1;
global moodle ;
test(‘测试\’,1,moodle)%ʵʱÓïÒô¼ì²â
% ——————————————————————–
function Open_Callback(hObject, eventdata, handles)
% hObject handle to Open (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(”)
file=get(handles.edits,[filename,pathname])
[y,f,b]=wavread(file);
% ——————————————————————–
function Exit_Callback(hObject, eventdata, handles)
% hObject handle to Exit (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
exit
% ——————————————————————–
function About_Callback(hObject, eventdata, handles)
% hObject handle to About (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
H=[‘语者识别’]
helpdlg(H,’help text’)
% ——————————————————————–
function File_Callback(hObject, eventdata, handles)
% hObject handle to File (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% ——————————————————————–
function Edit_Callback(hObject, eventdata, handles)
% hObject handle to Edit (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% ——————————————————————–
function Help_Callback(hObject, eventdata, handles)
% hObject handle to Help (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% — Executes on button press in pushbutton7.

function pushbutton7_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton7 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
msg=’请速度录音¡’
msgbox(msg)
clear
global data1;
%global dataDN1;
AI = analoginput(‘winsound’);
chan = addchannel(AI,1:2);
duration = 3; %1 second acquisition
set(AI,’SampleRate’,8000)
ActualRate = get(AI,’SampleRate’);
set(AI,’SamplesPerTrigger’,duration*ActualRate)
set(AI,’TriggerType’,’Manual’)
blocksize = get(AI,’SamplesPerTrigger’);
Fs = ActualRate;
start(AI)
trigger(AI)
[data1,time,abstime,events] = getdata(AI);
fname=sprintf(‘E:\Matlab语音识别系统\实时模版\s1.wav’)
%dataDN1=wden(data1,’heursure’,’s’,’one’,5,’sym8′);denoise
wavwrite(data1,fname)
msgbox(fname)
% — Executes on button press in pushbutton8.

function pushbutton8_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton8 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global data1;
%global dataDN1;
sound(data1)
%sound(dataDN1)
axes(handles.axes1)%set to plot at axes1
plot(data1);
%plot(dataDN1);
xlabel(‘训练采样序列’),ylabel(‘信号幅’);
%xlabel(‘ѵÁ·²ÉÑùÐòÁÐ’),ylabel(‘sym8С²¨½µÔëºóµÄÐźŷù’);
grid on;
clear
% — Executes on button press in pushbutton9.

function pushbutton9_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton9 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
msg=’请速度录音¡’
msgbox(msg)
clear
global data2;
%global dataDN2;
AI = analoginput(‘winsound’);
chan = addchannel(AI,1:2);
duration = 3; %1 second acquisition
set(AI,’SampleRate’,8000)
ActualRate = get(AI,’SampleRate’);
set(AI,’SamplesPerTrigger’,duration*ActualRate)
set(AI,’TriggerType’,’Manual’)
blocksize = get(AI,’SamplesPerTrigger’);
Fs = ActualRate;
start(AI)
trigger(AI)
[data2,time,abstime,events] = getdata(AI);
fname=sprintf(‘E:\Matlab语音识别系统\测试\s1.wav’)
%dataDN1=wden(data1,’heursure’,’s’,’one’,5,’sym8′);denoise
wavwrite(data2,fname)
msgbox(fname)
% — Executes on button press in pushbutton10.

function pushbutton10_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton10 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global data2;
%global dataDN2;
sound(data2)
%sound(dataDN2)
axes(handles.axes2)%set to plot at axes1
plot(data2);
%plot(dataDN2);
xlabel(‘测试采样序列’),ylabel(‘信号幅’);
%xlabel(‘²âÊÔ²ÉÑùÐòÁÐ’),ylabel(‘sym8С²¨½µÔëºóµÄÐźŷù’);%%
grid on;
clear
% — Executes on button press in pushbutton11.

function pushbutton11_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton11 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global moodle ;
testDB(‘测试\’,1,moodle)
% — Executes on button press in pushbutton12.

function pushbutton12_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton12 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global moodle;
moodle = train(‘实时模板\’,1)
% — Executes on selection change in popupmenu3.

function popupmenu3_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
str=get(handles.popupmenu3,’String’);
val=str2num(str{get(handles.popupmenu3,’Value’)});
switch val
case 1
case 2
case 3
case 4
case 5
case 6
case 7
case 8
case 9
end
% — Executes during object creation, after setting all properties.

function popupmenu3_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 && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
% — Executes on button press in pushbutton9.

function pushbutton13_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton9 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% — Executes on button press in pushbutton10.

function pushbutton14_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton10 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% — Executes during object creation, after setting all properties.

%function axes8_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes8 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called

% Hint: place code in OpeningFcn to populate axes8

Original: https://blog.csdn.net/m0_55395440/article/details/120305972
Author: m0_55395440
Title: 基于MATLAB的说话人识别系统

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/515874/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球