⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test2.m

📁 最全的ASR工具集合
💻 M
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -