mirror of
https://github.com/storytold/storyteller-ml.git
synced 2026-10-26 08:48:03 +00:00
support DIO
This commit is contained in:
@@ -27,6 +27,18 @@ def cache_harvest_f0(input_audio_path, fs, f0max, f0min, frame_period):
|
|||||||
f0 = pyworld.stonemask(audio, f0, t, fs)
|
f0 = pyworld.stonemask(audio, f0, t, fs)
|
||||||
return f0
|
return f0
|
||||||
|
|
||||||
|
@lru_cache
|
||||||
|
def cache_dio_f0(input_audio_path, fs, f0max, f0min, frame_period):
|
||||||
|
audio = input_audio_path2wav[input_audio_path]
|
||||||
|
f0, t = pyworld.dio(
|
||||||
|
audio,
|
||||||
|
fs=fs,
|
||||||
|
f0_ceil=f0max,
|
||||||
|
f0_floor=f0min,
|
||||||
|
frame_period=frame_period,
|
||||||
|
)
|
||||||
|
f0 = pyworld.stonemask(audio, f0, t, fs)
|
||||||
|
return f0
|
||||||
|
|
||||||
def change_rms(data1, sr1, data2, sr2, rate): # 1是输入音频,2是输出音频,rate是2的占比
|
def change_rms(data1, sr1, data2, sr2, rate): # 1是输入音频,2是输出音频,rate是2的占比
|
||||||
# print(data1.max(),data2.max())
|
# print(data1.max(),data2.max())
|
||||||
@@ -107,6 +119,11 @@ class VC(object):
|
|||||||
f0 = cache_harvest_f0(input_audio_path, self.sr, f0_max, f0_min, 10)
|
f0 = cache_harvest_f0(input_audio_path, self.sr, f0_max, f0_min, 10)
|
||||||
if filter_radius > 2:
|
if filter_radius > 2:
|
||||||
f0 = signal.medfilt(f0, 3)
|
f0 = signal.medfilt(f0, 3)
|
||||||
|
elif f0_method == "dio":
|
||||||
|
input_audio_path2wav[input_audio_path] = x.astype(np.double)
|
||||||
|
f0 = cache_dio_f0(input_audio_path, self.sr, f0_max, f0_min, 10)
|
||||||
|
if filter_radius > 2:
|
||||||
|
f0 = signal.medfilt(f0, 3)
|
||||||
elif f0_method == "crepe":
|
elif f0_method == "crepe":
|
||||||
model = "full"
|
model = "full"
|
||||||
# Pick a batch size that doesn't cause memory errors on your gpu
|
# Pick a batch size that doesn't cause memory errors on your gpu
|
||||||
|
|||||||
Reference in New Issue
Block a user