一、获取代码方式
获取代码方式1:
完整代码已上传我的资源:【语音识别】基于matlab说话人识别系统【含Matlab源码 1704期】
获取代码方式2:
通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码。
备注:
订阅紫极神光博客付费专栏,可免费获得1份代码(有效期为订阅日起,三天内有效);
二、部分源代码
function test(testdir, n, code)% Speaker Recognition: Testing Stage%% Input:% testdir : string name of directory contains all test sound files% n : number of test files in testdir% code : codebooks of all trained speakers%% Note:% Sound files in testdir is supposed to be: %s1.wav, s2.wav, ..., sn.wav%% Example:% >> test('C:\data\amintest\', 8, code);for k = 1:n % read test sound file of each speakerfile = sprintf('%ss%d.wav', testdir, k);[s, fs] = wavread(file);v = mfcc(s, fs); % Compute MFCC'sdistmin = inf;k1 = 0;for l = 1:length(code)% each trained codebook, compute distortiond = disteu(v, code{l}); dist = sum(min(d,[],2)) / size(d,1);if dist < distmindistmin = dist;k1 = l;endendmsg = sprintf('Speaker %d matches with speaker %d', k, k1);disp(msg);endfunction r = mfcc(s, fs)% MFCC%% Inputs: s contains the signal to analize% fs is the sampling rate of the signal%% Output: r contains the transformed signal%%%%%%%%%%%%%%%%%%%%%m = 100;n = 256;l = length(s);nbFrame = floor((l - n) / m) + 1;for i = 1:nfor j = 1:nbFrameM(i, j) = s(((j - 1) * m) + i);endendh = hamming(n);M2 = diag(h) * M;for i = 1:nbFrameframe(:,i) = fft(M2(:, i));endt = n / 2;tmax = l / fs;m = melfb(20, n, fs);n2 = 1 + floor(n / 2);z = m * abs(frame(1:n2, :)).^2;r = dct(log(z));
三、运行结果
四、matlab版本及参考文献
1 matlab版本
a
2 参考文献
[1]韩纪庆,张磊,郑铁然.语音信号处理(第3版)[M].清华大学出版社,.
[2]柳若边.深度学习:语音识别技术实践[M].清华大学出版社,.