Skip to content

Commit

Permalink
Disable sliding window search for match single
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanntg committed Apr 28, 2017
1 parent a367377 commit bb486b6
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions find_audio.m
Original file line number Diff line number Diff line change
Expand Up @@ -273,18 +273,24 @@
threshold_length = size(feat_template, 2);
end

% no zero starts
if ~match_single
if match_single
% match single... short circuit sliding window logic
[~, potential_ends] = min(scores);

% update start index
cor(cor == 0) = 1;
else
% no zero starts
scores(cor == 0) = nan;
end

% find minimum by sliding window
idx = sliding_window_indices(length(scores), round(size(feat_template, 2) / 2), round(size(feat_template, 2) / 4));
[mn, row] = min(scores(idx));
time_idx_with_min = row + idx(1, :) - 1; % convert row number to time index
% find minimum by sliding window
idx = sliding_window_indices(length(scores), round(size(feat_template, 2) / 2), round(size(feat_template, 2) / 4));
[mn, row] = min(scores(idx));
time_idx_with_min = row + idx(1, :) - 1; % convert row number to time index

% potential starts
potential_ends = unique(time_idx_with_min(~isnan(mn)));
% potential starts
potential_ends = unique(time_idx_with_min(~isnan(mn)));
end

% debug window
if debug
Expand Down

0 comments on commit bb486b6

Please sign in to comment.