Spaces:
Sleeping
Sleeping
Update vc_infer_pipeline.py
Browse files- vc_infer_pipeline.py +3 -4
vc_infer_pipeline.py
CHANGED
|
@@ -18,7 +18,6 @@ bh, ah = signal.butter(N=5, Wn=48, btype="high", fs=16000)
|
|
| 18 |
input_audio_path2wav = {}
|
| 19 |
|
| 20 |
|
| 21 |
-
|
| 22 |
def change_rms(data1, sr1, data2, sr2, rate): # 1是输入音频,2是输出音频,rate是2的占比
|
| 23 |
# print(data1.max(),data2.max())
|
| 24 |
rms1 = librosa.feature.rms(
|
|
@@ -91,7 +90,7 @@ class VC(object):
|
|
| 91 |
if inp_f0 is not None:
|
| 92 |
delta_t = np.round(
|
| 93 |
(inp_f0[:, 0].max() - inp_f0[:, 0].min()) * tf0 + 1
|
| 94 |
-
).astype(
|
| 95 |
replace_f0 = np.interp(
|
| 96 |
list(range(delta_t)), inp_f0[:, 0] * 100, inp_f0[:, 1]
|
| 97 |
)
|
|
@@ -107,7 +106,7 @@ class VC(object):
|
|
| 107 |
) + 1
|
| 108 |
f0_mel[f0_mel <= 1] = 1
|
| 109 |
f0_mel[f0_mel > 255] = 255
|
| 110 |
-
f0_coarse = np.rint(f0_mel).astype(np.int
|
| 111 |
return f0_coarse, f0bak # 1-0
|
| 112 |
|
| 113 |
def vc(
|
|
@@ -389,4 +388,4 @@ class VC(object):
|
|
| 389 |
del pitch, pitchf, sid
|
| 390 |
if torch.cuda.is_available():
|
| 391 |
torch.cuda.empty_cache()
|
| 392 |
-
return audio_opt
|
|
|
|
| 18 |
input_audio_path2wav = {}
|
| 19 |
|
| 20 |
|
|
|
|
| 21 |
def change_rms(data1, sr1, data2, sr2, rate): # 1是输入音频,2是输出音频,rate是2的占比
|
| 22 |
# print(data1.max(),data2.max())
|
| 23 |
rms1 = librosa.feature.rms(
|
|
|
|
| 90 |
if inp_f0 is not None:
|
| 91 |
delta_t = np.round(
|
| 92 |
(inp_f0[:, 0].max() - inp_f0[:, 0].min()) * tf0 + 1
|
| 93 |
+
).astype(np.int16)
|
| 94 |
replace_f0 = np.interp(
|
| 95 |
list(range(delta_t)), inp_f0[:, 0] * 100, inp_f0[:, 1]
|
| 96 |
)
|
|
|
|
| 106 |
) + 1
|
| 107 |
f0_mel[f0_mel <= 1] = 1
|
| 108 |
f0_mel[f0_mel > 255] = 255
|
| 109 |
+
f0_coarse = np.rint(f0_mel).astype(int) # Changed from np.int to int
|
| 110 |
return f0_coarse, f0bak # 1-0
|
| 111 |
|
| 112 |
def vc(
|
|
|
|
| 388 |
del pitch, pitchf, sid
|
| 389 |
if torch.cuda.is_available():
|
| 390 |
torch.cuda.empty_cache()
|
| 391 |
+
return audio_opt
|