sola for so-vits-svc40v2

This commit is contained in:
wataru 2023-04-15 04:47:40 +09:00
parent bc09f90bd3
commit b3a95b2f7e
2 changed files with 6 additions and 4 deletions

View File

@ -215,7 +215,7 @@ class SoVitsSvc40v2:
c = c.unsqueeze(0)
return c, f0, uv
def generate_input(self, newData: any, inputSize: int, crossfadeSize: int):
def generate_input(self, newData: any, inputSize: int, crossfadeSize: int, solaEnabled: bool = False, solaSearchFrame: int = 0):
newData = newData.astype(np.float32) / self.hps.data.max_wav_value
if hasattr(self, "audio_buffer"):
@ -223,7 +223,10 @@ class SoVitsSvc40v2:
else:
self.audio_buffer = newData
convertSize = inputSize + crossfadeSize + self.settings.extraConvertSize
if solaEnabled:
convertSize = inputSize + crossfadeSize + solaSearchFrame + self.settings.extraConvertSize
else:
convertSize = inputSize + crossfadeSize + self.settings.extraConvertSize
if convertSize % self.hps.data.hop_length != 0: # モデルの出力のホップサイズで切り捨てが発生するので補う。
convertSize = convertSize + (self.hps.data.hop_length - (convertSize % self.hps.data.hop_length))

View File

@ -208,7 +208,7 @@ class VoiceChanger():
# receivedData: tuple of short
def on_request(self, receivedData: AudioInOut) -> tuple[AudioInOut, list[Union[int, float]]]:
if self.settings.solaEnabled and (self.modelType == "RVC" or self.modelType == "MMVCv13" or self.modelType == "MMVCv15"):
if self.settings.solaEnabled:
return self.on_request_sola(receivedData)
else:
return self.on_request_legacy(receivedData)
@ -399,7 +399,6 @@ class VoiceChanger():
def export2onnx(self):
return self.voiceChanger.export2onnx()
##############
PRINT_CONVERT_PROCESSING: bool = False
# PRINT_CONVERT_PROCESSING = True