Can someone pls help me with this code. (mfcc)

whenever I am trying to run the code it is throwing an error i.e. =>
"Undefined function or variable 'melfilter'.
Error in mfcc (line 29)
filterBankMat = melfilter(N, Fs,@hamming); % matrix for a mel-spaced filterbank
Error in phase1 (line 17)
M = mfcc(y, Fs);"
% ============================================================
CODE:
function c = mfcc(y, Fs)
% MFCC Calculate the mel frequencey cepstrum coefficients (MFCC) of a signal
%
% Inputs:
% y : speech signal data
% Fs : sample rate in Hz of the speech signal data y
%
% Outputs:
% c : MFCC output, each column contains the MFCC's for one speech frame
N = 256; % frame size
M = 100; % inter frame distance
len = length(y);
numberOfFrames = 1 + floor((len - N)/double(M));
mat = zeros(N, numberOfFrames); % vector of frame vectors
for i=1:numberOfFrames
index = 100*(i-1) + 1;
for j=1:N
mat(j,i) = y(index);
index = index + 1;
end
end
hamW = hamming(N); % hamming window
afterWinMat = diag(hamW)*mat; % square diagonal matrix
freqDomMat = fft(afterWinMat); % FFT into freq domain
filterBankMat = melfilter(20,N, Fs); % matrix for a mel-spaced filterbank [HERE IT IS THROWING ERROR].
nby2 = 1 + floor(N/2);
ms = filterBankMat*abs(freqDomMat(1:nby2,:)).^2; % mel spectrum
c = dct(log(ms)); % mel-frequency cepstrum coefficients
c(1,:) = []; % exclude 0'th order cepstral coefficient
end

1 件のコメント

madhan ravi
madhan ravi 2018 年 11 月 23 日
編集済み: madhan ravi 2018 年 11 月 23 日
download FEX

サインインしてコメントする。

 採用された回答

Gaurav Sharma
Gaurav Sharma 2018 年 11 月 23 日

0 投票

on the mathwork website, melfilter is gievn as predefined funcion which can be directly used. That's why I am a bit confused. And if am trying to put melfiter as an input in the argument of the function mfcc, it throws an error of not enough input defined.
what should I do now?? I want to run this code since it is my project. Pls help me !!!

6 件のコメント

Gaurav Sharma
Gaurav Sharma 2018 年 11 月 23 日
am actually following this code sir, but my code still throws the same error, "not enough input arguments".
Walter Roberson
Walter Roberson 2018 年 11 月 23 日
when you call mfcc pass in @melfilter as the appropriate parameter
Gaurav Sharma
Gaurav Sharma 2018 年 11 月 23 日
Dear Sir, I appologise for asking this again but I didnt get what you want to say. May I request you to explain me a bit more. Matlab is new for me.
Thank You.
Gaurav Sharma
Gaurav Sharma 2018 年 11 月 23 日
Thank You sir, It worked.
hanif omar
hanif omar 2021 年 1 月 19 日
Dear @Gaurav Sharma , is this mfcc code start from pre emphasis ?

サインインしてコメントする。

その他の回答 (1 件)

Jacob Shulman
Jacob Shulman 2018 年 11 月 23 日

0 投票

if melfilter is a matrix you want to use then it must be an input to the function or be created and defined wihtin the function. functions create different new workspaces with new variables.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by