How to solve dimension problem

조회 수: 4 (최근 30일)
Kamil Kacer
Kamil Kacer 2020년 12월 13일
댓글: Walter Roberson 2021년 2월 26일
I got script like this and for some reason it works with some audio samples and with other it doesnt.
asc
ascacsSamples have same length exactly same number of samples but for some reason it gives me this error.
%
rm
assignment because the size of the left side is 13-by-1 and the size of the right side
is 3-by-1.
Error in stFeatureExtractionmfcc (line 61)
mfccFeatures(:,i) = zeros(numOfFeatures, 1);
Error in Mfccshoww (line 39)
Curframe{i} = stFeatureExtractionmfcc(frame, fs, 0.09, 0.03);
[Signal, fs] = audioread('long_sample_1.wav');
if (size(Signal,2)>1)
Signal = (sum(Signal,2)/2);% convert to MONO
end
% win = 0.31;
% step = 0.2;
%Testsamplemfcc = stFeatureExtractionmfcc(Signal, fs, win, step);
%spectrum model
% % fs = 44100;
% % T = 1/fs;
% % L = length(Features);
% % f = fs*(0:L-1)/L;
% % t = (0:L-1)*T;
% %
win = 0.31;
%win = 0.310090703; %% length of a single bark match with the window and step
step = 0.1;
curPos = 1;
windowLength = (win * fs);
Stepf = round(step * fs);
d = cell(1,1);
Length_signal = length(Signal);
numberOfFrames = floor((Length_signal-windowLength)/Stepf) + 1;
% = Featuresaudio(1:windowLength);
% % Featuresaudio
% [Features] = getDFT(Featuresaudio, 44100);
Ham = window(@hamming, windowLength);
for i = 1:numberOfFrames
frame = (Signal(curPos:curPos+windowLength-1));
%frame = frame .* Ham;
Curframe{i} = stFeatureExtractionmfcc(frame, fs, 0.09, 0.03);
%Curframe{i} = mean(Curframe{i},2);
Curframe{i} = Curframe{i}; % in case of transposing
d{i}= ((Curframe{i}-mfccFeatures{1}).^2);
d{i} = sum(d{i});
d{i} = sum(d{i},2);
curPos = curPos + Stepf;
end
d = cell2mat(d);
idx = zeros(1,1)
if all(d(:) > 200)
fprintf('Dog wasnt found in any frame')
else
idx = find(d(:) < 170);
%fprintf('Dog detected in frame number %d\n',idx(:))
end
for i = 1:length(idx);
idx(i) = idx(i) *0.1;
end
idx = round(idx,2);
fprintf('Dog detected at second %0.2f\n',idx(:))

답변 (1개)

Matt Gaidica
Matt Gaidica 2020년 12월 13일
It appears stFeatureExtractionmfcc() is returning multiple values. What is in that function?
  댓글 수: 6
Kamil Kacer
Kamil Kacer 2021년 2월 26일
Can you provide me with solution ? please
Walter Roberson
Walter Roberson 2021년 2월 26일
No, the situation is undefined, the code can only extract features when features exist, and does not define what the output should be when no features exist.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by