testing.m

来自「this code is in Matlab.and this code od 」· M 代码 · 共 36 行

M
36
字号


function testing(test_dir,code)

%  test_dir : string name of directory contains all test sound files
%  code    : codebooks of all trained speakers

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   Speaker Recognition System                        %
%                                                     %
%   Project mmembers: (1)  Habib ur Rehn=man          %
%                     (2)  Abdul Basit                %   
%   Date:   12-05-2003                                %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

k=1   % No of speakers to betested

                   
    file = sprintf('%ss%d%s.wav', test_dir,k,'t')         % read test sound file of each speaker
    [s, fs] = wavread(file);      
  
    v = mfcc(s, fs);                                      % Compute MFCC's
    distmin = inf;
    k1 = 0;
   
    for l = 1:length(code)                                 %  compute distortion
        d = euclid_dist(v, code{l}); 
        dist = sum(min(d,[],2)) / size(d,1);
      
        if dist < distmin
            distmin = dist;
            k1 = l;
        end      
    end
     dis_play(k1,distmin);                                   % call the dislpay routine to display the message
   

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?