Fix piper rate to length_scale mapping

This commit is contained in:
Kovid Goyal 2024-09-03 12:38:21 +05:30
parent 64c96c3245
commit dd8cbee521
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -287,7 +287,7 @@ class Piper(TTSBackend):
try:
self._load_voice_metadata()
s = EngineSpecificSettings.create_from_config(self.engine_name)
rate = max(0.1, 1 + s.rate) # maps -1 to 1 to 0.1 to 2
length_scale = max(0.1, 1 + -1 * s.rate) # maps -1 to 1 to 2 to 0.1
voice = self._voice_name_map.get(s.voice_name) or self._default_voice
model_path, config_path = self._ensure_voice_is_downloaded(voice)
except AttributeError as e:
@ -308,7 +308,7 @@ class Piper(TTSBackend):
cmdline = list(piper_cmdline()) + [
'--model', model_path, '--config', config_path, '--output-raw', '--json-input',
'--sentence-silence', '0', '--length_scale', str(rate)]
'--sentence-silence', '0', '--length_scale', str(length_scale)]
if is_debugging():
cmdline.append('--debug')
self._process.setProgram(cmdline[0])