基于MATLAB的说话人识别系统

基于MATLAB的说话人识别系统

  1. 语音识别的简单介绍

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

语音识别系统的框图如图1所示。

[En]

*The block diagram of the speech recognition system is shown in figure 1. *

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

  1. 语者识别的概念

说话人识别是根据说话人的语音信号来区分说话人的身份。言语是人类的自然属性之一。由于说话人发声器官的生理差异和后天习得的行为差异,每个人的言语都带有强烈的个人色彩,这使得通过分析语音信号来识别说话人成为可能。使用语音识别说话人的身份具有许多独特的优势,如语音是人的固有功能,不会丢失或遗忘;语音信号采集方便,系统设备成本低;利用电话网络还可以实现远程客服。因此,近年来,说话人识别受到越来越多的关注。与指纹识别、手识别等其他生物识别技术相比,说话人识别不仅使用方便,而且非接触,容易被用户接受,是现有生物识别技术中唯一可用于远程验证的识别技术。因此,说话人识别的应用前景非常广阔:今天,说话人识别技术已经涉及到多学科的研究领域,不同领域的进步促进了说话人识别的发展。说话人识别技术是一项涉及声学、语言学、计算机、信息处理、人工智能等多个领域的综合技术。在语音信号较硬的情况下,如何提取信号的关键成分就显得尤为重要。语音信号特征参数的好坏直接影响到语音识别的准确性。

[En]

Speaker recognition is to distinguish the identity of the speaker according to the speaker’s speech signal. Speech is one of the natural attributes of human beings. due to the physiological differences of the speaker’s vocal organs and the acquired behavior differences, everyone’s speech has a strong personal color, which makes it possible to identify the speaker by analyzing the speech signal. Using voice to identify the identity of the speaker has many unique advantages, such as voice is an inherent feature of people, will not be lost or forgotten; voice signal collection is convenient, the cost of system equipment is low; the use of telephone network can also achieve remote customer service. Therefore, in recent years, more and more attention has been paid to speaker recognition. Compared with other biometric technologies such as fingerprint recognition and hand recognition, speaker recognition is not only easy to use, but also non-contact, easy to be accepted by users, and among the existing biometric recognition technologies, it is the only recognition technology that can be used for remote verification. Therefore, the application prospect of speaker recognition is very broad: today, speaker recognition technology has been related to multi-disciplinary research fields, and advances in different fields have contributed to the development of speaker recognition. Speaker recognition technology is a comprehensive technology in many fields, such as acoustics, linguistics, computer, information processing, artificial intelligence and so on. When the speech signal is hard, how to extract the key components of the signal is particularly important. The quality of the characteristic parameters of speech signal directly leads to the accuracy of discrimination.

  1. 演示分析

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

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

实验过程及具体功能如下

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

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

figure1

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

选择加载到语音数据库中的语音数量

[En]

Select the number of voices loaded into the speech database

点击语音数据库录制模板,提取存储的语音信息

[En]

Click on the voice database recording template to extract the stored voice information

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

点击扬声器判断号码并显示。

[En]

Click on the speaker to judge the number and display it.

在实时语者识别模块:

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

如果你想测量多次,只需继续录制,自动保存,然后将音频与节目进行比较。

[En]

If you want to measure multiple times, just keep recording, save it automatically, and then compare the audio with the program.

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

  1. 运行代码

附: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

分享结束了,如果你愿意,请给安妮三个公司~聚美。

[En]

Sharing is over, please give Annie three companies ~ Jumi if you like

Original: https://blog.csdn.net/m0_65908410/article/details/122254037
Author: 话外仙子
Title: 基于MATLAB的说话人识别系统

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

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

(0)

大家都在看

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