Spaces:
Paused
Paused
Commit
路
68b7c84
1
Parent(s):
4482c12
Update vc_infer_pipeline.py
Browse files- vc_infer_pipeline.py +9 -1
vc_infer_pipeline.py
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
-
import numpy as np, parselmouth, torch, pdb
|
| 2 |
from time import time as ttime
|
| 3 |
import torch.nn.functional as F
|
| 4 |
import scipy.signal as signal
|
| 5 |
import pyworld, os, traceback, faiss, librosa, torchcrepe
|
| 6 |
from scipy import signal
|
| 7 |
from functools import lru_cache
|
|
|
|
|
|
|
| 8 |
|
| 9 |
bh, ah = signal.butter(N=5, Wn=48, btype="high", fs=16000)
|
| 10 |
|
|
@@ -124,6 +126,12 @@ class VC(object):
|
|
| 124 |
f0 = torchcrepe.filter.mean(f0, 3)
|
| 125 |
f0[pd < 0.1] = 0
|
| 126 |
f0 = f0[0].cpu().numpy()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
f0 *= pow(2, f0_up_key / 12)
|
| 128 |
# with open("test.txt","w")as f:f.write("\n".join([str(i)for i in f0.tolist()]))
|
| 129 |
tf0 = self.sr // self.window # 姣忕f0鐐规暟
|
|
|
|
| 1 |
+
import numpy as np, parselmouth, torch, pdb, sys, os
|
| 2 |
from time import time as ttime
|
| 3 |
import torch.nn.functional as F
|
| 4 |
import scipy.signal as signal
|
| 5 |
import pyworld, os, traceback, faiss, librosa, torchcrepe
|
| 6 |
from scipy import signal
|
| 7 |
from functools import lru_cache
|
| 8 |
+
now_dir = os.getcwd()
|
| 9 |
+
sys.path.append(now_dir)
|
| 10 |
|
| 11 |
bh, ah = signal.butter(N=5, Wn=48, btype="high", fs=16000)
|
| 12 |
|
|
|
|
| 126 |
f0 = torchcrepe.filter.mean(f0, 3)
|
| 127 |
f0[pd < 0.1] = 0
|
| 128 |
f0 = f0[0].cpu().numpy()
|
| 129 |
+
elif f0_method == "rmvpe":
|
| 130 |
+
if(hasattr(self,"model_rmvpe")==False):
|
| 131 |
+
from rmvpe import RMVPE
|
| 132 |
+
print("loading rmvpe model")
|
| 133 |
+
self.model_rmvpe = RMVPE("rmvpe.pt",is_half=self.is_half, device=self.device)
|
| 134 |
+
f0 = self.model_rmvpe.infer_from_audio(x, thred=0.03)
|
| 135 |
f0 *= pow(2, f0_up_key / 12)
|
| 136 |
# with open("test.txt","w")as f:f.write("\n".join([str(i)for i in f0.tolist()]))
|
| 137 |
tf0 = self.sr // self.window # 姣忕f0鐐规暟
|