Skip to content

Commit

Permalink
防止末尾空切片
Browse files Browse the repository at this point in the history
  • Loading branch information
leng-yue committed Feb 14, 2023
1 parent 564d7cc commit 0735473
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions fish_audio_preprocess/utils/slice_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ def slice_audio(

arr.append(np.zeros(silent_shape, dtype=audio.dtype))

_gen = np.concatenate(arr)
yield from slice_by_max_duration(_gen, max_duration, rate)
if duration > 0:
_gen = np.concatenate(arr)
yield from slice_by_max_duration(_gen, max_duration, rate)


def slice_audio_file(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "fish-audio-preprocess"
version = "0.1.8"
version = "0.1.9"
description = "Preprocess audio data"
authors = ["Lengyue <[email protected]>"]
license = "Apache"
Expand Down

0 comments on commit 0735473

Please sign in to comment.