Skip to content

Commit cc2d6bf

Browse files
authored
fixed nonspeech skip (#436)
-fixed `align()` failing skip audio segment even when the segment contains no detectable speech Co-authored-by: Yoad <[email protected]>
1 parent 650cc4b commit cc2d6bf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

stable_whisper/non_whisper/alignment.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,13 +875,14 @@ def _skip_nonspeech(
875875
return audio_segment
876876

877877
segment_samples = audio_segment.size(-1)
878+
segment_duration = segment_samples / self.sample_rate
878879

879880
max_time_offset = self._time_offset + self.options.post.min_word_dur
880881
min_time_offset = self._time_offset - self.options.post.min_word_dur
881882

882883
if (
883884
(segment_nonspeech_timings[0][0] < max_time_offset) and
884-
(segment_nonspeech_timings[1][0] > min_time_offset + segment_samples)
885+
(segment_nonspeech_timings[1][0] > min_time_offset + segment_duration)
885886
):
886887
# entire audio segment is within first nonspeech section
887888
self._seek_sample += segment_samples

0 commit comments

Comments
 (0)