train.asv
上传用户:jzquartz
上传日期:2008-06-09
资源大小:389k
文件大小:1k
- 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:dataamintrain', 8);
- %%%%%%%%%%%%%%%%%%
- %
- % Author: Amin Koohi(Sohrevardi)
- % AminSohrevardi@yahoo.com , AminKoohi@yahoo.com
- %************************
- k = 16; % number of centroids required
- for 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 codebook
- end