embedded matlab function error with MFCC features
Show older comments
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*
Accepted Answer
More Answers (0)
Categories
Find more on Naming Conventions in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!