Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix compute_f0_crepe returning wrong length #42

Merged
merged 1 commit into from
Mar 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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