Skip to content

Commit

Permalink
fix: change f0 method from crepe to dio
Browse files Browse the repository at this point in the history
BREAKING CHANGE: all default values for f0 method  changed
  • Loading branch information
34j committed Mar 24, 2023
1 parent 59724cd commit 24353e6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/so_vits_svc_fork/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def infer(
"-fm",
"--f0-method",
type=click.Choice(["crepe", "crepe-tiny", "parselmouth", "dio", "harvest"]),
default="crepe",
default="dio",
help="f0 prediction method",
)
@click.option("-p", "--pad-seconds", type=float, default=0.02, help="pad seconds")
Expand Down Expand Up @@ -505,7 +505,7 @@ def pre_config(
"-fm",
"--f0-method",
type=click.Choice(["crepe", "crepe-tiny", "parselmouth", "dio", "harvest"]),
default="crepe",
default="dio",
)
def pre_hubert(
input_dir: Path,
Expand Down
10 changes: 5 additions & 5 deletions src/so_vits_svc_fork/inference/infer_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def get_unit_f0(
speaker: int | str,
f0_method: Literal[
"crepe", "crepe-tiny", "parselmouth", "dio", "harvest"
] = "crepe",
] = "dio",
):
f0 = utils.compute_f0(
audio,
Expand Down Expand Up @@ -172,7 +172,7 @@ def infer(
noise_scale: float = 0.4,
f0_method: Literal[
"crepe", "crepe-tiny", "parselmouth", "dio", "harvest"
] = "crepe",
] = "dio",
) -> tuple[torch.Tensor, int]:
audio = audio.astype(np.float32)
# get speaker id
Expand Down Expand Up @@ -240,7 +240,7 @@ def infer_silence(
noise_scale: float = 0.4,
f0_method: Literal[
"crepe", "crepe-tiny", "parselmouth", "dio", "harvest"
] = "crepe",
] = "dio",
# slice config
db_thresh: int = -40,
pad_seconds: float = 0.5,
Expand Down Expand Up @@ -459,7 +459,7 @@ def infer(
noise_scale: float = 0.4,
f0_method: Literal[
"crepe", "crepe-tiny", "parselmouth", "dio", "harvest"
] = "crepe",
] = "dio",
# slice config
db_thresh: int = -40,
pad_seconds: float = 0.5,
Expand Down Expand Up @@ -519,7 +519,7 @@ def process(
noise_scale: float = 0.4,
f0_method: Literal[
"crepe", "crepe-tiny", "parselmouth", "dio", "harvest"
] = "crepe",
] = "dio",
# slice config
db_thresh: int = -40,
chunk_seconds: float = 0.5,
Expand Down
8 changes: 2 additions & 6 deletions src/so_vits_svc_fork/inference_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ def infer(
auto_predict_f0: bool = False,
cluster_infer_ratio: float = 0,
noise_scale: float = 0.4,
f0_method: Literal[
"crepe", "crepe-tiny", "parselmouth", "dio", "harvest"
] = "crepe",
f0_method: Literal["crepe", "crepe-tiny", "parselmouth", "dio", "harvest"] = "dio",
# slice config
db_thresh: int = -40,
pad_seconds: float = 0.5,
Expand Down Expand Up @@ -83,9 +81,7 @@ def realtime(
auto_predict_f0: bool = False,
cluster_infer_ratio: float = 0,
noise_scale: float = 0.4,
f0_method: Literal[
"crepe", "crepe-tiny", "parselmouth", "dio", "harvest"
] = "crepe",
f0_method: Literal["crepe", "crepe-tiny", "parselmouth", "dio", "harvest"] = "dio",
# slice config
db_thresh: int = -40,
pad_seconds: float = 0.5,
Expand Down
12 changes: 3 additions & 9 deletions src/so_vits_svc_fork/preprocess_hubert_f0.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ def _process_one(
sampling_rate: int,
hop_length: int,
device: Literal["cuda", "cpu"] = "cuda",
f0_method: Literal[
"crepe", "crepe-tiny", "parselmouth", "dio", "harvest"
] = "crepe",
f0_method: Literal["crepe", "crepe-tiny", "parselmouth", "dio", "harvest"] = "dio",
force_rebuild: bool = False,
):
wav, sr = librosa.load(filepath, sr=sampling_rate)
Expand Down Expand Up @@ -59,9 +57,7 @@ def _process_batch(
sampling_rate: int,
hop_length: int,
pbar_position: int,
f0_method: Literal[
"crepe", "crepe-tiny", "parselmouth", "dio", "harvest"
] = "crepe",
f0_method: Literal["crepe", "crepe-tiny", "parselmouth", "dio", "harvest"] = "dio",
force_rebuild: bool = False,
):
device = "cuda" if torch.cuda.is_available() else "cpu"
Expand All @@ -83,9 +79,7 @@ def preprocess_hubert_f0(
input_dir: Path | str,
config_path: Path | str,
n_jobs: int = 4,
f0_method: Literal[
"crepe", "crepe-tiny", "parselmouth", "dio", "harvest"
] = "crepe",
f0_method: Literal["crepe", "crepe-tiny", "parselmouth", "dio", "harvest"] = "dio",
force_rebuild: bool = False,
):
input_dir = Path(input_dir)
Expand Down
2 changes: 1 addition & 1 deletion src/so_vits_svc_fork/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def compute_f0(
p_len: None | int = None,
sampling_rate: int = 44100,
hop_length: int = 512,
method: Literal["crepe", "crepe-tiny", "parselmouth", "dio", "harvest"] = "crepe",
method: Literal["crepe", "crepe-tiny", "parselmouth", "dio", "harvest"] = "dio",
**kwargs,
):
with timer() as t:
Expand Down

0 comments on commit 24353e6

Please sign in to comment.