embedded matlab function error with MFCC features

hello evry body: i used also embedded matlab function in simulink to extract the Mfcc caracteristics of isolated words, but thay give me somme errors: this is may code: ******************************************************************************************************************
function [ceps] = mfcc6(input)
lowestFrequency = 133.3333;
linearFilters = 13;
linearSpacing = 66.66666666;
logFilters = 27;
logSpacing = 1.0711703;
fftSize = 256;
cepstralCoefficients = 12;
windowSize = 256;
samplingRate = 8000;
frameRate = 100;
totalFilters = linearFilters + logFilters;
freqs = lowestFrequency + (0:linearFilters-1)*linearSpacing;
freqs(linearFilters+1:totalFilters+2) = freqs(linearFilters) * logSpacing.^(1:logFilters+2);
lower = freqs(1:totalFilters);
center = freqs(2:totalFilters+1);
upper = freqs(3:totalFilters+2);
mfccFilterWeights = zeros(totalFilters,fftSize);
triangleHeight = 2./(upper-lower);
fftFreqs = (0:fftSize-1)/fftSize*samplingRate;
for chan=1:totalFilters
mfccFilterWeights(chan,:) = (fftFreqs > lower(chan) & fftFreqs <= center(chan)).* triangleHeight(chan).*(fftFreqs-lower(chan))/(center(chan)-lower(chan)) + ...
(fftFreqs > center(chan) & fftFreqs < upper(chan)).* triangleHeight(chan).*(upper(chan)-fftFreqs)/(upper(chan)-center(chan));
end
hamWindow = 0.54 - 0.46*cos(2*pi*(0:windowSize-1)/windowSize);
mfccDCTMatrix = 1/sqrt(totalFilters/2)*cos((0:(cepstralCoefficients-1))' * (2*(0:(totalFilters-1))+1) * pi/2/totalFilters);
mfccDCTMatrix(1,:) = mfccDCTMatrix(1,:) * sqrt(2)/2;
preEmphasized = filter([1 -.97], 1, input');
windowStep = samplingRate/frameRate;
cols = fix((length(input')-windowSize)/windowStep);
ceps = zeros(cepstralCoefficients, cols);
for start=0:cols-1
first = start*windowStep + 1;
last = first + windowSize-1;
fftData = zeros(1,fftSize);
fftData(1:windowSize) = preEmphasized(first:last).* hamWindow;
fftMag = abs(fft(fftData));
earMag = log10(mfccFilterWeights * fftMag');
ceps(:,start+1) = mfccDCTMatrix * earMag;
end
end
********************************************************************************************************************** it give me the fellowing errors: ******************************************************************************************************
1- Function output 'y' cannot be of MATLAB type.
Function 'Parametrisation MFCC/mfcc6' (#240.0.282), line 1, column 1:
"function y = paramettre(x)"
2- Errors occurred during parsing of Embedded MATLAB function 'Parametrisation
MFCC/mfcc6'(#240)
3-Embedded MATLAB Interface Error: Errors occurred during parsing of Embedded MATLAB function 'Parametrisation MFCC/mfcc6'(#240) .
*******************************************************************
*best regard*

 採用された回答

Kaustubha Govind
Kaustubha Govind 2012 年 7 月 25 日
編集済み: Kaustubha Govind 2012 年 7 月 25 日

0 投票

You need to pre-declare 'y' to the expected output type of your function. See this documentation section for an explanation.

2 件のコメント

latsi lab
latsi lab 2012 年 7 月 25 日
in this case y _is the same with _ceps; i pre declare _ceps_by
ceps = zeros(cepstralCoefficients, cols);
but when i run the model it give this error.
Function output 'y' cannot be of MATLAB type.
Kaustubha Govind
Kaustubha Govind 2012 年 7 月 26 日
Could you also pre-declare 'y' in a similar fashion?

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDeep Learning Toolbox についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by