test2.m
来自「最全的ASR工具集合」· M 代码 · 共 37 行
M
37 行
function test2(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\test\', 8, code);
%for k = 1:n % read test sound file of each speaker
file = sprintf('%ss%d.wav', testdir, 3);
[s fs]=wavread(file);
%[s, fs] = wavread('data\test\s3.wav');
v = mfcc(s, fs); % Compute MFCC's
distmin = 3;
% each trained codebook, compute distortion
d = disteu(v, code{3});
dist = sum(min(d,[],2)) / size(d,1);
disp('--------------------');
disp(dist);
if dist < distmin
msg = sprintf('Speaker %d is the right person',3)
disp(msg);
else
msg = sprintf('Speaker %d is not the right person',3)
disp(msg);
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?