sola for so-vits-svc40

This commit is contained in:
wataru 2023-04-15 04:42:54 +09:00
parent 74a8674b63
commit bc09f90bd3
5 changed files with 22 additions and 2 deletions

View File

@ -157,6 +157,10 @@
{ {
"name": "trancateNumThreshold", "name": "trancateNumThreshold",
"options": {} "options": {}
},
{
"name": "solaEnable",
"options": {}
} }
] ]
}, },

View File

@ -157,6 +157,10 @@
{ {
"name": "trancateNumThreshold", "name": "trancateNumThreshold",
"options": {} "options": {}
},
{
"name": "solaEnable",
"options": {}
} }
] ]
}, },

View File

@ -157,6 +157,10 @@
{ {
"name": "trancateNumThreshold", "name": "trancateNumThreshold",
"options": {} "options": {}
},
{
"name": "solaEnable",
"options": {}
} }
] ]
}, },

View File

@ -157,6 +157,10 @@
{ {
"name": "trancateNumThreshold", "name": "trancateNumThreshold",
"options": {} "options": {}
},
{
"name": "solaEnable",
"options": {}
} }
] ]
}, },

View File

@ -252,7 +252,7 @@ class SoVitsSvc40:
c = c.unsqueeze(0) c = c.unsqueeze(0)
return c, f0, uv 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 newData = newData.astype(np.float32) / self.hps.data.max_wav_value
if hasattr(self, "audio_buffer"): if hasattr(self, "audio_buffer"):
@ -260,6 +260,9 @@ class SoVitsSvc40:
else: else:
self.audio_buffer = newData self.audio_buffer = newData
if solaEnabled:
convertSize = inputSize + crossfadeSize + solaSearchFrame + self.settings.extraConvertSize
else:
convertSize = inputSize + crossfadeSize + self.settings.extraConvertSize convertSize = inputSize + crossfadeSize + self.settings.extraConvertSize
if convertSize % self.hps.data.hop_length != 0: # モデルの出力のホップサイズで切り捨てが発生するので補う。 if convertSize % self.hps.data.hop_length != 0: # モデルの出力のホップサイズで切り捨てが発生するので補う。
@ -349,6 +352,7 @@ class SoVitsSvc40:
audio = self._onnx_inference(data) audio = self._onnx_inference(data)
else: else:
audio = self._pyTorch_inference(data) audio = self._pyTorch_inference(data)
return audio return audio
def __del__(self): def __del__(self):