Handle empty voices URL format

This commit is contained in:
Michael Hansen 2022-04-01 10:21:53 -04:00
commit f13b1accf6
2 changed files with 20 additions and 8 deletions

View file

@ -349,7 +349,11 @@ def process_line(
for result in results:
state.result_queue.put(
ResultToProcess(result=result, line=line, line_id=line_id,)
ResultToProcess(
result=result,
line=line,
line_id=line_id,
)
)
# Restore voice/speaker
@ -477,10 +481,14 @@ def get_args():
help="Format of stdin text (default: auto)",
)
parser.add_argument(
"--voice", "-v", help="Name of voice (expected in <voices-dir>/<language>)",
"--voice",
"-v",
help="Name of voice (expected in <voices-dir>/<language>)",
)
parser.add_argument(
"--speaker", "-s", help="Name or number of speaker (default: first speaker)",
"--speaker",
"-s",
help="Name or number of speaker (default: first speaker)",
)
parser.add_argument(
"--voices-dir",
@ -520,7 +528,9 @@ def get_args():
)
parser.add_argument(
"--noise-scale", type=float, help="Noise scale [0-1], default is 0.667",
"--noise-scale",
type=float,
help="Noise scale [0-1], default is 0.667",
)
parser.add_argument(
"--length-scale",
@ -528,7 +538,9 @@ def get_args():
help="Length scale (1.0 is default speed, 0.5 is 2x faster)",
)
parser.add_argument(
"--noise-w", type=float, help="Variation in cadence [0-1], default is 0.8",
"--noise-w",
type=float,
help="Variation in cadence [0-1], default is 0.8",
)
# Miscellaneous

View file

@ -69,7 +69,7 @@ class Mimic3Settings:
voices_directories: typing.Optional[typing.Iterable[typing.Union[str, Path]]] = None
"""Directories to search for voices (<lang>/<voice>)"""
voices_url_format: str = DEFAULT_VOICES_URL_FORMAT
voices_url_format: typing.Optional[str] = DEFAULT_VOICES_URL_FORMAT
"""URL format string for a voice directory.
May contain:
@ -238,7 +238,7 @@ class Mimic3TextToSpeechSystem(TextToSpeechSystem):
description="",
speakers=speakers,
location=str.format(
self.settings.voices_url_format,
self.settings.voices_url_format or DEFAULT_VOICES_URL_FORMAT,
lang=voice_lang,
name=voice_name,
key=voice_key,
@ -471,7 +471,7 @@ class Mimic3TextToSpeechSystem(TextToSpeechSystem):
voice_lang, voice_name = voice_key.split("/", maxsplit=1)
voice_info = _VOICES[voice_key]
voice_url = str.format(
self.settings.voices_url_format,
self.settings.voices_url_format or DEFAULT_VOICES_URL_FORMAT,
key=voice_key,
lang=voice_lang,
name=voice_name,