[Voice recognition] Voiceprint recognition based on matlab GUI [including Matlab source code 537]

1. Introduction

This paper designs and implements a text-related voiceprint recognition system based on Matlab, which can determine the speaker's identity.
1 System principle
a. Voiceprint recognition In the
    past two years, with the development of artificial intelligence, many mobile apps have introduced the function of voiceprint lock. The technology used here is mainly related to voiceprint recognition. Voiceprint recognition is also called speaker recognition, and there is a little difference between it and speech recognition.
Insert picture description here
b.
Mel Frequency Cepstrum Coefficient (MFCC) Mel Frequency Cepstrum Coefficient (MFCC) is one of the most commonly used speech signal characteristics in speech signal processing.
Experimental observations found that the human ear is like a filter bank, it only pays attention to certain specific frequencies on the spectrum. The human ear's sound frequency perception range does not follow a linear relationship in the frequency spectrum, but follows an approximately linear relationship in the Mel frequency domain.
The Mel frequency cepstrum coefficient takes into account the characteristics of human hearing. First, the linear frequency spectrum is mapped to the Mel nonlinear frequency spectrum based on auditory perception, and then converted to the cepstrum. The relationship between ordinary frequency conversion to Mel frequency is:
Insert picture description here
c. Vector Quantization (VectorQuantization)
This system uses vector quantization to compress the extracted speech MFCC features.
VectorQuantization (VQ) is a lossy data compression method based on block coding rules. In fact, there is a VQ step in multimedia compression formats such as JPEG and MPEG-4. Its basic idea is: to form a vector of several scalar data groups, and then quantize the whole in the vector space, thereby compressing the data without losing much information.
3 System structure The structure of the
entire system in this article is shown in the figure below:
  – Training process
Firstly, the speech signal is preprocessed, and then the MFCC characteristic parameters are extracted, and the vector quantization method is used for compression, and the codebook of the speaker's pronunciation is obtained. The same speaker says the same content many times, repeat the training process, and finally form a codebook library.
  – Recognition process
During recognition, the speech signal is also preprocessed, MFCC features are extracted, and the Euclidean distance between this feature and the training library codebook is compared. When it is less than a certain threshold, we determine that the speaker and the content of the speech are consistent with those in the training codebook library, and the pairing is successful.
Insert picture description here
4 Test experiment It
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
can be seen that the "password is correct" will be displayed only when the speaker and the content of the speech are completely consistent with the codebook library, otherwise it will display "the password is wrong", and the related functions of the voiceprint lock are realized.

Second, the source code

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

% Last Modified by GUIDE v2.5 17-Mar-2019 09:58:00

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @test4_OpeningFcn, ...
                   'gui_OutputFcn',  @test4_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 test4 is made visible.
function test4_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 test4 (see VARARGIN)

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

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = test4_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)
global thk1 thk2 thk3 
global tlc1 tlc2 tlc3
global tlyy1 tlyy2 tlyy3 
global tqs1 tqs2 tqs3
global tyqc1 tyqc2 tyqc3
global startpos len

startpos=601;
len=399;
[s,fs]=audioread('训练样本hk1.wav');
thk1= MFCC2par(s,fs);
thk1=thk1(startpos:startpos+len,1:12);

[s,fs]=audioread('训练样本hk2.wav');
thk2= MFCC2par(s,fs);
thk2=thk2(startpos:startpos+len,1:12);

[s,fs]=audioread('训练样本hk3.wav');
thk3= MFCC2par(s,fs);
thk3=thk3(startpos:startpos+len,1:12);

[s,fs]=audioread('训练样本lc1.wav');
tlc1= MFCC2par(s,fs);
tlc1=tlc1(startpos:startpos+len,1:12);

[s,fs]=audioread('训练样本lc2.wav');
tlc2= MFCC2par(s,fs);
tlc2=tlc2(startpos:startpos+len,1:12);

[s,fs]=audioread('训练样本lc3.wav');
tlc3= MFCC2par(s,fs);
tlc3=tlc3(startpos:startpos+len,1:12);

[s,fs]=audioread('训练样本lyy1.wav');
tlyy1= MFCC2par(s,fs);
tlyy1=tlyy1(startpos:startpos+len,1:12);

[s,fs]=audioread('训练样本lyy2.wav');
tlyy2= MFCC2par(s,fs);
tlyy2=tlyy2(startpos:startpos+len,1:12);

[s,fs]=audioread('训练样本lyy3.wav');
tlyy3= MFCC2par(s,fs);
tlyy3=tlyy3(startpos:startpos+len,1:12);

[s,fs]=audioread('训练样本qs1.wav');
tqs1= MFCC2par(s,fs);
tqs1=tqs1(startpos:startpos+len,1:12);

[s,fs]=audioread('训练样本qs2.wav');
tqs2= MFCC2par(s,fs);
tqs2=tqs2(startpos:startpos+len,1:12);

[s,fs]=audioread('训练样本qs3.wav');
tqs3= MFCC2par(s,fs);
tqs3=tqs3(startpos:startpos+len,1:12);

[s,fs]=audioread('训练样本yqc1.wav');
tyqc1= MFCC2par(s,fs);
tyqc1=tyqc1(startpos:startpos+len,1:12);

[s,fs]=audioread('训练样本yqc2.wav');
tyqc2= MFCC2par(s,fs);
tyqc2=tyqc2(startpos:startpos+len,1:12);
function getmfcc= MFCC2par( x,fs)
 %=========================================================
 % 无去噪及端点检测
 % Input:音频数据x,采样率fs
 % Output:(N,M)大小的特征参数矩阵  其中N为分帧个数,M为特征维度
 % 特征参数:M=24 倒谱系数12维,一阶差分12%=========================================================

%[x fs]=wavread(sound);
%取单声道信号
[~,etmp]=size(x);
if (etmp==2)
x=x(:,1);
end

%归一化mel滤波器组系数

bank=melbankm(24,256,fs,0,0.5,'m');%Mel滤波器的阶数为24,fft变换的长度为256,采样频率为8000Hz  

bank=full(bank);

bank=bank/max(bank(:));%[24*129]

 %设定DCT系数
 
for k=1:12

n=0:23;

dctcoef(k,:)=cos((2*n+1)*k*pi/(2*24));

end

%归一化倒谱提升窗口

w=1+6*sin(pi*[1:12]./12);

w=w/max(w);


%预加重滤波器

xx=double(x);

xx=filter([1-0.9375],1,xx);%预加重

xx=enframe(xx,256,80);%对x 256点分为一帧


%计算每帧的MFCC参数

for i=1:size(xx,1)

y=xx(i,:);%取一帧数据

s=y'.*hamming(256);

t=abs(fft(s));%fft快速傅立叶变换  幅度谱

t=t.^2; %能量谱

%对fft参数进行mel滤波取对数再计算倒谱
c1=dctcoef*log(bank*t(1:129));%对能量谱滤波及DCT %t(1:129)对一帧的前128个数(帧移为128)

c2=c1.*w';%归一化倒谱

%mfcc参数

m(i,:)=c2';

end

Three, running results

Insert picture description here
Insert picture description here

Four, remarks

Complete code or writing add QQ 1564658423 past review
>>>>>>
[Feature extraction] Audio watermark embedding and extraction based on matlab wavelet transform [Include Matlab source code 053]
[Speech processing] Voice signal processing based on matlab GUI [Include Matlab Source code issue 290]
[Voice acquisition] based on matlab GUI voice signal collection [including Matlab source code 291]
[Voice modulation] based on matlab GUI voice amplitude modulation [including Matlab source code 292]
[Speech synthesis] based on matlab GUI voice synthesis [including Matlab Source code issue 293]
[Voice encryption] Voice signal encryption and decryption based on matlab GUI [With Matlab source code 295]
[Speech enhancement] Matlab wavelet transform-based voice enhancement [Matlab source code 296]
[Voice recognition] Based on matlab GUI voice base frequency Recognition [Including Matlab source code 294]
[Speech enhancement] Matlab GUI Wiener filtering based voice enhancement [Including Matlab source code 298]
[Speech processing] Based on matlab GUI voice signal processing [Including Matlab source code 299]
[Signal processing] Based on Matlab speech signal spectrum analyzer [including Matlab source code 325]
[Modulation signal] Digital modulation signal simulation based on matlab GUI [including Matlab source code 336]
[Emotion recognition] Voice emotion recognition based on matlab BP neural network [including Matlab source code 349 Issue]
[Voice Steganography] Quantified Audio Digital Watermarking Based on Matlab Wavelet Transform [Include Matlab Source Code Issue 351]
[Feature extraction] based on matlab audio watermark embedding and extraction [including Matlab source code 350 period]
[speech denoising] based on matlab low pass and adaptive filter denoising [including Matlab source code 352 period]
[emotion recognition] based on matlab GUI voice emotion classification Recognition [Including Matlab source code 354 period]
[Basic processing] Matlab-based speech signal preprocessing [Including Matlab source code 364 period]
[Speech recognition] Matlab Fourier transform 0-9 digital speech recognition [Including Matlab source code 384 period]
[Speech Recognition] 0-9 digital speech recognition based on matlab GUI DTW [including Matlab source code 385]
[Voice playback] Matlab GUI MP3 design [including Matlab source code 425]
[Voice processing] Speech enhancement algorithm based on human ear masking effect Noise ratio calculation [Including Matlab source code 428]
[Speech denoising] Based on matlab spectral subtraction denoising [Including Matlab source code 429]
[Speech recognition] BP neural network speech recognition based on the momentum item of matlab [Including Matlab source code 430]
[Voice steganography] based on matlab LSB voice hiding [including Matlab source code 431]
[Voice recognition] based on matlab male and female voice recognition [including Matlab source code 452]
[Voice processing] based on matlab voice noise adding and noise reduction processing [including Matlab source code Issue 473]
[Speech denoising] based on matlab least squares (LMS) adaptive filter [including Matlab source code 481]
[Speech enhancement] based on matlab spectral subtraction, least mean square and Wiener filter speech enhancement [including Matlab source code 482 period】
[Communication] based on matlab GUI digital frequency band (ASK, PSK, QAM) modulation simulation [including Matlab source code 483]
[Signal processing] based on matlab ECG signal processing [including Matlab source code 484]
[Voice broadcast] based on matlab voice Broadcast [Including Matlab source code 507]
[Signal processing] Matlab wavelet transform based on EEG signal feature extraction [Including Matlab source code 511]
[Voice processing] Based on matlab GUI dual tone multi-frequency (DTMF) signal detection [Including Matlab source code 512 】
【Voice steganography】based on matlab LSB to realize the digital watermark of speech signal 【Include Matlab source code 513】
【Speech enhancement】Speech recognition based on matlab matched filter 【Include Matlab source code 514】
【Speech processing】Based on matlab GUI voice Frequency domain spectrogram analysis [including Matlab source code 527]
[Speech denoising] based on matlab LMS, RLS algorithm voice denoising [including Matlab source code 528]
[Voice denoising] based on matlab LMS spectral subtraction voice denoising [including Matlab Source code issue 529]
[Voice denoising] based on matlab soft threshold, hard threshold, compromise threshold voice denoising [including Matlab source code 530]
[Voice recognition] based on matlab specific person's voice recognition discrimination [including Matlab source code 534]
[ Speech denoising] based on matlab wavelet soft threshold speech noise reduction [including Matlab source code 531]
[speech denoising] based on matlab wavelet hard threshold speech noise reduction [including Matlab source code 532]
[speech recognition] based on matlab MFCC and SVM specific Human gender recognition [including Matlab source code 533]
[Speech recognition] GMM speech recognition based on MFCC [including Matlab source code 535 period]
[Voice recognition] Based on matlab VQ specific person isolated word speech recognition [including Matlab source code 536 period]

Guess you like

Origin blog.csdn.net/TIQCmatlab/article/details/114906910