1
0
mirror of https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI.git synced 2026-06-08 20:10:44 +08:00

optimize(crepe): move crepe into rvc.f0

This commit is contained in:
源文雨
2024-06-14 14:29:36 +09:00
parent f79b925ee2
commit e298fde29c
7 changed files with 106 additions and 54 deletions

View File

@@ -1,14 +1,25 @@
from typing import Any, Optional, Union
import torch
import numpy as np
class F0Predictor(object):
def __init__(self, hop_length=512, f0_min=50, f0_max=1100, sampling_rate=44100):
def __init__(
self,
hop_length=512,
f0_min=50,
f0_max=1100,
sampling_rate=44100,
device: Optional[str] = None,
):
self.hop_length = hop_length
self.f0_min = f0_min
self.f0_max = f0_max
self.sampling_rate = sampling_rate
if device is None:
device = "cuda:0" if torch.cuda.is_available() else "cpu"
self.device = device
def compute_f0(
self,