Skip to content

Commit

Permalink
Improve match single to use length constraint
Browse files Browse the repository at this point in the history
Calculate the threshold for match_single respecting the length constraint. Produces better matches.
  • Loading branch information
nathanntg committed Apr 29, 2017
1 parent 4d154e1 commit d3c0924
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions find_audio.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d3c0924

Please sign in to comment.