diff --git a/find_audio.m b/find_audio.m index bf3180f..87641fd 100644 --- a/find_audio.m +++ b/find_audio.m @@ -251,12 +251,7 @@ % single extraction mode if match_single - t = sort(scores); - if isempty(thresh_score) - thresh_score = t(4); - else - thresh_score = t(thresh_score); - end + thresh_score = Inf; end % threshold @@ -286,10 +281,18 @@ if match_single % match single... short circuit sliding window logic - [~, potential_ends] = min(scores); + [s, potential_ends] = min(scores); + + % no score + if isnan(s) + potential_ends = []; + end % update start index - cor(cor == 0) = 1; + if any(cor(potential_ends) == 0) + warning('Matches at boundary, may be clipped.'); + cor(cor == 0) = 1; + end else % no zero starts scores(cor == 0) = nan;