Problem with last step of program while debugging
1 回表示 (過去 30 日間)
古いコメントを表示
My code works perfect until the last line as you see at the picture 

but when i click next step it give me these random numbers

I want it to stop a the detection of dogs but i does this and i dont know why
function v = andrejbican(Signal, fs)
load('Mmfcc.mat')
% % [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);
if length(Signal) < 13671
Signal(end:13671) = 1;
end
%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.08, 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(:) > 230)
fprintf('Dog wasnt found in any frame')
else
idx = find(d(:) < 230);
%fprintf('Dog detected in frame number %d\n',idx(:))
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(:))
end
these are my 2 functions Iam calling with the one below
function [Signal, fs] = callingmfs(sample)
[Signal, fs] = audioread(sample);
if (size(Signal,2)>1)
Signal = (sum(Signal,2)/2); % convert to MONO
end
andrejbican(Signal, fs);
2 件のコメント
Walter Roberson
2021 年 2 月 26 日
As you do not show how callingmfs is being invoked, my suspicion would be that you are seeing the output from callingmfs() as I speculate that you did not put semi-colon on the end of the call to it.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Feature Extraction についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!