Skip to content

Commit

Permalink
Merge pull request #199 from snakers4/adamnsandle
Browse files Browse the repository at this point in the history
fx end of chunk may exceed audio length
  • Loading branch information
adamnsandle authored Jun 2, 2022
2 parents 900c71a + 8eba346 commit 7c671a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils_vad.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ def get_speech_timestamps(audio: torch.Tensor,
speech['end'] += int(silence_duration // 2)
speeches[i+1]['start'] = int(max(0, speeches[i+1]['start'] - silence_duration // 2))
else:
speech['end'] += int(speech_pad_samples)
speeches[i+1]['start'] -= int(speech_pad_samples)
speech['end'] = int(min(audio_length_samples, speech['end'] + speech_pad_samples))
speeches[i+1]['start'] = int(max(0, speeches[i+1]['start'] - speech_pad_samples))
else:
speech['end'] = int(min(audio_length_samples, speech['end'] + speech_pad_samples))

Expand Down

0 comments on commit 7c671a7

Please sign in to comment.