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

chore(format): run black on dev (#3)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2024-06-06 01:03:19 +09:00
committed by GitHub
parent 6e8feb9028
commit c94f3f6748
5 changed files with 49 additions and 14 deletions

View File

@@ -9,7 +9,9 @@ class DioF0Predictor(F0Predictor):
def __init__(self, hop_length=512, f0_min=50, f0_max=1100, sampling_rate=44100):
super().__init__(hop_length, f0_min, f0_max, sampling_rate)
def compute_f0(self, wav: np.ndarray[typing.Any, np.dtype], p_len: int | None = None):
def compute_f0(
self, wav: np.ndarray[typing.Any, np.dtype], p_len: int | None = None
):
if p_len is None:
p_len = wav.shape[0] // self.hop_length
f0, t = pyworld.dio(
@@ -24,7 +26,9 @@ class DioF0Predictor(F0Predictor):
f0[index] = round(pitch, 1)
return self.__interpolate_f0(self.__resize_f0(f0, p_len))[0]
def compute_f0_uv(self, wav: np.ndarray[typing.Any, np.dtype], p_len: int | None = None):
def compute_f0_uv(
self, wav: np.ndarray[typing.Any, np.dtype], p_len: int | None = None
):
if p_len is None:
p_len = wav.shape[0] // self.hop_length
f0, t = pyworld.dio(

View File

@@ -1,6 +1,7 @@
import numpy as np
import typing
class F0Predictor(object):
def __init__(self, hop_length=512, f0_min=50, f0_max=1100, sampling_rate=44100):
self.hop_length = hop_length
@@ -8,9 +9,13 @@ class F0Predictor(object):
self.f0_max = f0_max
self.sampling_rate = sampling_rate
def compute_f0(self, wav: np.ndarray[typing.Any, np.dtype], p_len: int | None = None): ...
def compute_f0(
self, wav: np.ndarray[typing.Any, np.dtype], p_len: int | None = None
): ...
def compute_f0_uv(self, wav: np.ndarray[typing.Any, np.dtype], p_len: int | None = None): ...
def compute_f0_uv(
self, wav: np.ndarray[typing.Any, np.dtype], p_len: int | None = None
): ...
def __interpolate_f0(self, f0: np.ndarray[typing.Any, np.dtype]):
"""
@@ -49,7 +54,7 @@ class F0Predictor(object):
last_value = data[i]
return ip_data[:, 0], vuv_vector[:, 0]
def __resize_f0(self, x: np.ndarray[typing.Any, np.dtype], target_len: int):
source = np.array(x)
source[source < 0.001] = np.nan

View File

@@ -9,7 +9,9 @@ class HarvestF0Predictor(F0Predictor):
def __init__(self, hop_length=512, f0_min=50, f0_max=1100, sampling_rate=44100):
super().__init__(hop_length, f0_min, f0_max, sampling_rate)
def compute_f0(self, wav: np.ndarray[typing.Any, np.dtype], p_len: int | None = None):
def compute_f0(
self, wav: np.ndarray[typing.Any, np.dtype], p_len: int | None = None
):
if p_len is None:
p_len = wav.shape[0] // self.hop_length
f0, t = pyworld.harvest(
@@ -22,7 +24,9 @@ class HarvestF0Predictor(F0Predictor):
f0 = pyworld.stonemask(wav.astype(np.double), f0, t, self.fs)
return self.__interpolate_f0(self.__resize_f0(f0, p_len))[0]
def compute_f0_uv(self, wav: np.ndarray[typing.Any, np.dtype], p_len: int | None = None):
def compute_f0_uv(
self, wav: np.ndarray[typing.Any, np.dtype], p_len: int | None = None
):
if p_len is None:
p_len = wav.shape[0] // self.hop_length
f0, t = pyworld.harvest(

View File

@@ -9,7 +9,9 @@ class PMF0Predictor(F0Predictor):
def __init__(self, hop_length=512, f0_min=50, f0_max=1100, sampling_rate=44100):
super().__init__(hop_length, f0_min, f0_max, sampling_rate)
def compute_f0(self, wav: np.ndarray[typing.Any, np.dtype], p_len: int | None = None):
def compute_f0(
self, wav: np.ndarray[typing.Any, np.dtype], p_len: int | None = None
):
x = wav
if p_len is None:
p_len = x.shape[0] // self.hop_length
@@ -33,7 +35,9 @@ class PMF0Predictor(F0Predictor):
f0, uv = self.__interpolate_f0(f0)
return f0
def compute_f0_uv(self, wav: np.ndarray[typing.Any, np.dtype], p_len: int | None = None):
def compute_f0_uv(
self, wav: np.ndarray[typing.Any, np.dtype], p_len: int | None = None
):
x = wav
if p_len is None:
p_len = x.shape[0] // self.hop_length