MFCC Speaker verification system
10 views (last 30 days)
Show older comments
it gives me error, could some one help me in my mfcc speaker verfication system code:
here it is my code:
%recorder = auidorecorder(16000,8,2);
Firstrecorder = audiorecorder;
msgbox("Register Your Voice");
recordblocking(Firstrecorder,3);
msgbox("Recording STOP");
assignin("base","Firstrecorder",Firstrecorder);
Fs = 24000;
Fn = Fs/2;
wp = 1000/Fn;
ws = 1010/Fn;
rp =1;
rs = 150;
[n,ws] = cheb2ord(wp,ws,rp,rs);
[z,p,k] = cheby2(n,rs,ws,'high');
[soslp,glp] = zp2sos(z,p,k);
% Save First user Voice in the DataBase:
Firstrecorder = evalin("base","Firstrecorder");
y = getaudiodata(Firstrecorder);
fs = Firstrecorder.SampleRate;
%sound(y,fs); %play(recorder);
filename = "A.wav"
audiowrite(filename,y,fs);
% Save Second user Voice in the DataBase:
Secondrecorder = evalin("base","Secondrecorder");
y3 = getaudiodata(Secondrecorder);
fs3 = Secondrecorder.SampleRate;
%sound(y3,fs3); %play(recorder);
filename3 = "C.wav"
audiowrite(filename3,y3,fs3);
[AA,F] = audioread("A.wav");
SS = [1*F,F*6];
[BB,F] = audioread("A.wav",SS);
zizo =mfcc(BB(:,1),F);
[AA,F] =audioread('A.wav');
SS = [1*F,F*6];
[BB,F] = audioread('A.wav',SS);
zizo = mfcc (BB(:,1),F);
[AA,F] =audioread('C.wav');
SS = [1*F,F*6];
[BB,F] = audioread('C.wav',SS);
zizo2 = mfcc (BB(:,1),F);
coeffs = {zizo;zizo2};
[file, path] = uigetfile('A.wav','select an sound file', 'A.wav');
[y,F] =audioread(file);
SS = [1*F,F*6];
[BB,F] = audioread(file,SS);
zizo3 = mfcc (BB(:,1),F);
set(handles.text2,'String',file);
sound(y,F);
for time = 1:10 set(handles.text5,'String',file);
pause(1.2);
end
end
0 Comments
Answers (2)
Walter Roberson
on 4 Apr 2021
The code you posted has too many end statements.
It looks to me as if the code is intended to be used together with a GUI, and that possibly you removed a "function" declaration, so possibly your original code does not have too many end statements.
Secondrecorder = evalin("base","Secondrecorder");
Secondrecorder does not exist in the base workspace. You created Firstrecorder there but not Secondrecorder .
There is probably not much advantage in storing the audiorecorder objects in the base workspace: just extract the data and sampling frequency and (if you must) store that. You can use the same audiorecorder object to record the second voice.
2 Comments
Walter Roberson
on 5 Apr 2021
If you have code like that,then you should not have
Firstrecorder = audiorecorder;
msgbox("Register Your Voice");
recordblocking(Firstrecorder,3);
msgbox("Recording STOP");
assignin("base","Firstrecorder",Firstrecorder);
in this code: you should only have it in the code for the callback for the first button.
You already have the sound values and sample rates in memory after you getaudiodata : there is no need to write them to a file and read from the file. It does not hurt to write them to a file if you want to examine the file later for debugging purposes, but there is no reason for your code to read back from the files in those cases.
[AA,F] = audioread("A.wav");
SS = [1*F,F*6];
[BB,F] = audioread("A.wav",SS);
Why do you re-read the file? Why not just say that
BB = AA(1:min(end,F*6),:)
?
zizo =mfcc(BB(:,1),F);
[AA,F] =audioread('A.wav');
SS = [1*F,F*6];
[BB,F] = audioread('A.wav',SS);
zizo = mfcc (BB(:,1),F);
Why do that all again? You just did that 5 lines further up.
[file, path] = uigetfile('A.wav','select an sound file', 'A.wav');
Why not menu() asking which one to select? Or is it deliberate that you want the user to be able to choose a different file completely?
There is nothing obviously wrong with the way you calculate the mfcc coefficients... you just do not do anything with the coefficients after you compute them!
saeed ahmad
on 4 May 2021
Hello brother, I am making a similar system. Can you write me I need some help. samawan0609@gmail.com
0 Comments
See Also
Categories
Find more on Speech Recognition in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

