Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
matlab中的MFCC代码_Matlab - Fatal编程技术网

matlab中的MFCC代码

matlab中的MFCC代码,matlab,Matlab,我有mfcc代码,但我不知道如何使用主程序调用函数并绘制它。你能帮我吗 因为在我的项目中,我必须计算文件音频的mfcc 函数[CC,FBE,frames]=mfcc(语音,fs,Tw,Ts,alpha,window,R,M,N,L) %%预备赛 % Ensure correct number of inputs if( nargin~=10) help mfcc; return; end; % Explode samples to the range of 16 bit sh

我有mfcc代码,但我不知道如何使用主程序调用函数并绘制它。你能帮我吗 因为在我的项目中,我必须计算文件音频的mfcc

函数[CC,FBE,frames]=mfcc(语音,fs,Tw,Ts,alpha,window,R,M,N,L)

%%预备赛

% Ensure correct number of inputs
if( nargin~=10)
    help mfcc; 
   return;
end; 

% Explode samples to the range of 16 bit shorts
if( max(abs(speech))<=1 )
    speech = speech * 2^15; 
end;

Nw = round( 1E-3*Tw*fs );    % frame duration (samples)
Ns = round( 1E-3*Ts*fs );    % frame shift (samples)

nfft = 2^nextpow2( Nw );     % length of FFT analysis 
K = nfft/2+1;                % length of the unique part of the FFT 


%% HANDY INLINE FUNCTION HANDLES

% Forward and backward mel frequency warping (see Eq. (5.13) on p.76 of [1]) 
% Note that base 10 is used in [1], while base e is used here and in HTK code
hz2mel = @( hz )( 1127*log(1+hz/700) );     % Hertz to mel warping function
mel2hz = @( mel )( 700*exp(mel/1127)-700 ); % mel to Hertz warping function

% Type III DCT matrix routine (see Eq. (5.14) on p.77 of [1])
dctm = @( N, M )( sqrt(2.0/M) * cos( repmat((0:N-1).',1,M) ...
                                   .* repmat(pi*((1:M)-0.5)/M,N,1) ) );

% Cepstral lifter routine (see Eq. (5.12) on p.75 of [1])
ceplifter = @( N, L )( 1+0.5*L*sin(pi*(0:N-1)/L) );


%% FEATURE EXTRACTION 

% Preemphasis filtering (see Eq. (5.1) on p.73 of [1])
speech = filter( [1 -alpha], 1, speech ); % fvtool( [1 -alpha], 1 );

% Framing and windowing (frames as columns)
frames = vec2frames( speech, Nw, Ns, 'cols', window, false );

% Magnitude spectrum computation (as column vectors)
MAG = abs( fft(frames,nfft,1) ); 

% Triangular filterbank with uniformly spaced filters on mel scale
H = trifbank( M, K, R, fs, hz2mel, mel2hz ); % size of H is M x K 

% Filterbank application to unique part of the magnitude spectrum
FBE = H * MAG(1:K,:);
FBE( FBE<1.0 ) = 1.0; % apply mel floor

% DCT matrix computation
DCT = dctm( N, M );

% Conversion of logFBEs to cepstral coefficients through DCT
CC =  DCT * log( FBE );

% Cepstral lifter computation
lifter = ceplifter( N, L );

% Cepstral liftering gives liftered cepstral coefficients
CC = diag( lifter ) * CC; % ~ HTK's MFCCs
%确保输入的数量正确
if(nargin~=10)
帮助mfcc;
返回;
结束;
%将样本分解到16位短路的范围

如果(max(abs(speech))我假设mfcc与之相同,您是否在文档中尝试过该示例:

function [ CC, FBE, frames ] = mfcc( speech, fs, Tw, Ts, alpha, window, R, M, N, L )
% MFCC Mel frequency cepstral coefficient feature extraction.
%
%   MFCC(S,FS,TW,TS,ALPHA,WINDOW,R,M,N,L) returns mel frequency
 ....
%   Example
%           Tw = 25;           % analysis frame duration (ms)
%           Ts = 10;           % analysis frame shift (ms)
%           alpha = 0.97;      % preemphasis coefficient
%           R = [ 300 3700 ];  % frequency range to consider
%           M = 20;            % number of filterbank channels 
%           C = 13;            % number of cepstral coefficients
%           L = 22;            % cepstral sine lifter parameter
...