Skip to content

Commit afef580

Browse files
committed
fix off-by-one
1 parent 8f180f9 commit afef580

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pyannote/audio/utils/signal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def __call__(self, scores: SlidingWindowFeature) -> Annotation:
274274

275275
for k, k_scores in enumerate(scores.data.T):
276276
label = k if scores.labels is None else scores.labels[k]
277-
277+
278278
# Detect transitions
279279
is_active = k_scores > self.onset
280280
transitions = np.diff(is_active.astype(int))
@@ -287,7 +287,7 @@ def __call__(self, scores: SlidingWindowFeature) -> Annotation:
287287

288288
# If the last frame is active, add it as an end
289289
if is_active[-1]:
290-
ends = np.append(ends, len(is_active))
290+
ends = np.append(ends, len(is_active) - 1)
291291

292292
# Create segments
293293
for start, end in zip(starts, ends):

0 commit comments

Comments
 (0)