How to solve dimension problem
4 ビュー (過去 30 日間)
古いコメントを表示
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(:))
0 件のコメント
回答 (1 件)
Matt Gaidica
2020 年 12 月 13 日
It appears stFeatureExtractionmfcc() is returning multiple values. What is in that function?
6 件のコメント
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 Center および File Exchange で Multirate Signal Processing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!