train.m

来自「speaker recognition matlab code」· M 代码 · 共 31 行

M
31
字号
function code = train(traindir, n)% Speaker Recognition: Training Stage%% Input:%       traindir : string name of directory contains all train sound files%       n        : number of train files in traindir%% Output:%       code     : trained VQ codebooks, code{i} for i-th speaker%% Note:%       Sound files in traindir is supposed to be: %                       s1.wav, s2.wav, ..., sn.wav% Example:%       >> code = train('C:\data\amintrain\', 8);%%%%%%%%%%%%%%%%%%k = 16;                         % number of centroids requiredfor i = 1:n                     % train a VQ codebook for each speaker    file = sprintf('%ss%d.wav', traindir, i);               disp(file);       [s, fs] = wavread(file);        v = mfcc(s, fs);            % Compute MFCC's       code{i} = vqlbg(v, k);      % Train VQ codebookend

⌨️ 快捷键说明

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