How to solve dimension problem

1 Ansicht (letzte 30 Tage)
Kamil Kacer
Kamil Kacer am 13 Dez. 2020
Kommentiert: Walter Roberson am 26 Feb. 2021
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(:))

Antworten (1)

Matt Gaidica
Matt Gaidica am 13 Dez. 2020
It appears stFeatureExtractionmfcc() is returning multiple values. What is in that function?
  6 Kommentare
Kamil Kacer
Kamil Kacer am 26 Feb. 2021
Can you provide me with solution ? please
Walter Roberson
Walter Roberson am 26 Feb. 2021
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Time-Frequency Analysis finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by