close all;
chos=0;
possibility=5;
messaggio='Insert the number of set: each set determins a class. This set should include a number of speech for each person, with some variations in expression and in the lighting.';
while chos~=possibility,
chos=menu('speaker identification System by LiGuangCheng','Select speech signal and add to database','Select speech signal for speaker identification','Delete database',...
'speech signal: visualization','Exit');
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% Calculate gmm of the speech and Add to Database
if chos==1
clc;
close all;
selezionato=0;
while selezionato==0
[namefile,pathname]=uigetfile({'*.wav','speech Files (*.wav)'},'Chose speech signal');
if namefile~=0
selezionato=1;
else
disp('Select a speech signal');
end
end
filt=melfilter(150,300,15);
fr1=frm(strcat(pathname,namefile),16,8000,1);
mc2=train(fr1,filt,20);
mc2=mc2(3:18,:);
mc1=banshengsin(mc2);
s1=pitch(pathname,namefile);
a=length(s1);
b=length(mc1(1,:));
if a>b
s1(b+1:a)=[];
else
s1(a+1:b)=0;
end
mc1=[mc1;s1];
[im is ip]=init(mc1,16);
[nim1 nis1 nip1 times]=gmm(im,is,ip,mc1);
data=struct('name',{},'means',{},'cov',{},'prob',{},'pitch',{});
if (exist('speech_database.dat')==2)
load('speech_database.dat','-mat');
speaker_number=speaker_number+1;
prompt={'Enter the name of speaker to add'};
name='the speaker ';
numlines=1;
defaultanswer={'no one'};
answer=inputdlg(prompt,name,numlines,defaultanswer);
data(speaker_number).name=answer{1,1};
data(speaker_number).means=nim1;
data(speaker_number).cov=readcov(nis1);
data(speaker_number).prob=nip1;
data(speaker_number).pitch=s1;
save('speech_database.dat','data','speaker_number','-append');
else
speaker_number=1;
prompt={'Enter the name of speaker to add'};
name='the speaker ';
numlines=1;
defaultanswer={'no one'};
answer=inputdlg(prompt,name,numlines,defaultanswer);
data(speaker_number).name=answer{1,1};
data(speaker_number).means=nim1;
data(speaker_number).cov=readcov(nis1);
data(speaker_number).prob=nip1;
data(speaker_number).pitch=s1;
save('speech_database.dat','data','speaker_number');
end
message=strcat('speechsignal was succesfully added to database. speaker is.. ',answer{1,1})
msgbox(message,'speechsignal DataBase','help')
end
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% speaker recognition
if chos==2
clc;
close all;
selezionato=0;
while selezionato==0
[namefile,pathname]=uigetfile({'*.wav','speech Files (*.wav)'},'Chose speech signal');
if namefile~=0
selezionato=1;
else
disp('Select a speech signal');
end
end
if (exist('speech_database.dat')==2)
load('speech_database.dat','-mat');
filt=melfilter(150,300,15);
fr=frm(strcat(pathname,namefile),16,8000,3);
l=length(fr(1,:));
nosp=length(data);
k=0;
b=0;
r=nosp;
while(r~=1)
r=floor(r/2);
k=k+1;
end
p(2,nosp)=0;p(1,1)=0;
for i=1:nosp
p(2,i)=i;
end
mc4=train(fr,filt,20);
mc4=mc4(3:18,:);
mc=banshengsin(mc4);
pitch2=pitch(pathname,namefile);
a=length(pitch2);
b=length(mc(1,:));
if a>b
pitch2(b+1:a)=[];
else
pitch2(a+1:b)=0;
end
mc=[mc;pitch2];
coff=length(mc(:,1));
o=length(mc(1,:));
frameparts=struct('frame',{});
s=mod(l,k);
y=floor(l/k);
if s==0
for i=1:k
frameparts(i).frame(coff,y)=0;
end
else
for i=1:s
frameparts(i).frame(coff,y+1)=0;
end
for i=s+1:k
frameparts(i).frame(coff,y)=0;
end
end
for r=1:k
count=1;
for i=r:k:l
frameparts(r).frame(:,count)=mc(:,i);
count=count+1;
end
end
c=length(data);
for i=1:k
% tic
p1=ident2(frameparts(i).frame,filt,data,p);
% toc
p=upd_pr(p,p1);
p=nmax1(p);
end
p2=p(1)/o;
scores=zeros(nosp,1);
for i=1:nosp
pitch1=data(i).pitch';
% tic
scores(i,1)=myDTW(pitch2,pitch1(1:length(pitch2)));
% toc
end
scores;
[m,n]=sort(scores);
b=p(2,1);
if or((p2>-25),b==n)
nm=data(b).name;
message=strcat('The speaker is : ',nm);
msgbox(message,'DataBase Info','help');
else
message='the speaker is a stranger.';
msgbox(message,'DataBase Info','help');
end
else
message='DataBase is empty. No check is possible.';
msgbox(message,'speech DataBase Error','warn');
end
end
%删除全部数据,或只删除一个人的数据
if chos==3
clc;
close all;
if (exist('speech_database.dat')==2)
load('speech_database.dat','-mat');
button = questdlg('which speaker do you want to delete?',...
'Genie Question',...
'all','specified','all');
if strcmp(button,'all')
delete('speech_database.dat');
msgbox('Database was succesfully removed from the current directory.','Database removed','help');
else
prompt={'Enter the name of speaker you want to delete'};
name='specified speaker delete';
numlines=1;
defaultanswer={'0'};
answer=inputdlg(prompt,name,numlines,defaultanswer);
nspeaker=length(data);
names=cell(1,nspeaker);
for i=1:nspeaker
names{1,i}=data(i).name;
end
[a,b]=ismember(answer{1,1},names);
if a==0
warndlg('the speaker is not exist.','Warining')
else
data(b)=[];
speaker_number=length(data);
save('speech_database.dat','data','speaker_number','-append');
message=strcat('you have succesfully removed The speaker : ',answer{1,1});
msgbox(message,'specified speaker removed','help');
end
end
else
warndlg('Database is empty.',' Warning ')
end
end
if chos==4
clc;
close all;
selezionato=0;
while selezionato==0
[namefile,pathname]=uigetfile({'*.wav','speech signal (*.wav)'},'Chose speech signal');
if namefile~=0
[x,fs]=wavread(strcat(pathname,namefile));
selezionato=1;
else
disp('Select a speech signal');
end
end
figure('Name','Selected speech signal');
plot(x);
pause;
x=trim(x);
plot(x);
pause;
filt=melfilter(150,300,15);
fr1=frm(strcat(pathname,namefile),16,8000,1);
size(fr1)
mc2=train(fr1,filt,20);
colormap(1-gray);
imagesc(mc2);
pause;
mc2=mc2(3:18,:);
imagesc(mc2);
pause;
y=bansin(16)
plot(y);
pause;
mc1=banshengsin(mc2);
imagesc(mc1);
pause;
% cor=CorrelogramArray(fr1,x,256);
% [pixels frames] = size(cor);
% colormap(1-gray);
%for j=1:frames
% imagesc(reshape(cor(:,j),pixels/256,256));
% drawnow;
%end
没有合适的资源?快使用搜索试试~ 我知道了~
基于matlab实现的声纹识别功能
共24个文件
m:20个
asv:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 9 下载量 194 浏览量
2024-01-12
00:38:20
上传
评论 5
收藏 18KB ZIP 举报
温馨提示
基于matlab实现的声纹识别功能 - 不懂运行,下载完可以私聊问,可远程教学 该资源内项目源码是个人的毕设,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! <项目介绍> 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。 --------
资源推荐
资源详情
资源评论
收起资源包目录
VoiceprintRecognition-master.zip (24个子文件)
VoiceprintRecognition-master
enframe.m 3KB
bansin.m 81B
train.m 311B
ident2.asv 602B
init.m 401B
upd_pr.m 93B
mfcc.asv 269B
nmax1.m 143B
readcov.m 176B
myDTW.m 1KB
gmm.m 2KB
start.m 8KB
banshengsin.asv 181B
banshengsin.m 191B
pitch.asv 2KB
test4.m 8KB
frm.m 922B
pitch.m 2KB
melfilter.m 587B
split.m 900B
ident2.m 628B
trim.m 3KB
melinv.m 50B
mfcc.m 260B
共 24 条
- 1
机智的程序员zero
- 粉丝: 2416
- 资源: 4812
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Complex-YOLO点云上的实时 3D 物体检测 pytorch Darknet.zip
- 基于HOG+SVM的行人检测,包含三个python代码和一个训练好的模型Model,两张检测图片
- 扫雷游戏的实现,运行版本
- eclipse安装包eclipse-inst-jre-win64.zip
- HCIE数通V3.0宝典全面解析路由协议
- 基于AT89S52单片机数字音乐盒的设计.ASM
- caffe 中的 YOLOv3 模型.zip
- Android流式布局-开发类似网页的热门标签
- Android Live Demo 使用 ncnn 进行 Yolov7 推理.zip
- 像写SQL一样写ORM,链式方法调用,结合Lambda,枚举 灵活适应各种情况 使用不同种类数据库的实体生成器,支持:MySQL,MongoDb,Excel,一致性的调用方法 对数据进行分组,方便
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页