Skip to content

Commit

Permalink
fix: fix compute_f0_crepe returning wrong length (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
34j committed Mar 20, 2023
1 parent 695c773 commit afb42b0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/so_vits_svc_fork/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import torchcrepe
from numpy import dtype, float32, ndarray
from scipy.io.wavfile import read
from torch import FloatTensor
from torch import FloatTensor, Tensor
from tqdm import tqdm

LOG = getLogger(__name__)
Expand Down Expand Up @@ -219,7 +219,7 @@ def compute_f0_crepe(
# (T) -> (1, T)
audio = audio.detach()

pitch = torchcrepe.predict(
pitch: Tensor = torchcrepe.predict(
audio,
sampling_rate,
hop_length,
Expand All @@ -231,7 +231,10 @@ def compute_f0_crepe(
pad=True,
)

return pitch.detach().cpu().numpy()[0]
f0 = pitch.squeeze(0).cpu().numpy()
p_len = p_len or wav_numpy.shape[0] // hop_length
f0 = _resize_f0(f0, p_len)
return f0


def compute_f0(
Expand Down

0 comments on commit afb42b0

Please sign in to comment.