Skip to content

Commit

Permalink
Merge pull request #13 from rhasspy/piper-voices
Browse files Browse the repository at this point in the history
Fix piper voice links
  • Loading branch information
synesthesiam authored Apr 21, 2023
2 parents ba2ffe8 + 0352fe9 commit 11e8d30
Showing 1 changed file with 76 additions and 33 deletions.
109 changes: 76 additions & 33 deletions programs/tts/piper/script/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,64 +8,97 @@
_DIR = Path(__file__).parent
_LOGGER = logging.getLogger("setup")

_VOICE_NAMES = [
"ca-upc_ona-x-low",
"ca-upc_pau-x-low",
"da-nst_talesyntese-medium",
"de-eva_k-x-low",
"de-thorsten-low",
"en-gb-alan-low",
"en-gb-southern_english_female-low",
"en-us-amy-low",
"en-us-kathleen-low",
"en-us-lessac-low",
"en-us-lessac-medium",
"en-us-libritts-high",
"en-us-ryan-high",
"en-us-ryan-low",
"en-us-ryan-medium",
"es-carlfm-x-low",
"fi-harri-low",
"fr-siwis-low",
"fr-siwis-medium",
"it-riccardo_fasol-x-low",
"kk-iseke-x-low",
"kk-issai-high",
"kk-raya-x-low",
"ne-google-medium",
"ne-google-x-low",
"nl-mls_7432-low",
"nl-nathalie-x-low",
"nl-rdh-medium",
"nl-rdh-x-low",
"no-talesyntese-medium",
"pl-mls_6892-low",
"pt-br-edresson-low",
"uk-lada-x-low",
"vi-25hours-single-low",
"vi-vivos-x-low",
"zh-cn-huayan-x-low",
]

_VOICES = {
"catalan": "ca",
"ca": "ca_upc_ona",
"ca_upc_ona": "ca_upc_ona",
"ca_upc_pau": "ca_upc_pau",
"ca": "ca-upc_ona-x-low",
#
"danish": "da",
"da": "da_nst_talesynthese",
"da_nst_talesynthese": "da_nst_talesyntese",
"da": "da-nst_talesyntese-medium",
#
"german": "de",
"de": "de_thorsten",
"de_thorsten": "de_thorsten",
"de_eva_k": "de_eva_k",
"de": "de-thorsten-low",
#
"english": "en-us",
"en-us": "en-us_lessac",
"en-us_lessac": "en-us_lessac",
"en-us_ljspeech": "en-us_ljspeech",
"en-us_ryan": "en-us_ryan",
"english": "en",
"en": "en-us",
"en-us": "en-us-lessac-low",
"en-gb": "en-gb-alan-low",
#
"spanish": "es",
"es": "es_carlfm",
"es_carlfm": "es_carlfm",
"es": "es-carlfm-x-low",
#
"french": "fr",
"fr": "fr_siwis",
"fr_siwis": "fr_siwis",
"fr": "fr-siwis-low",
#
"italian": "it",
"it": "it_riccardo_fasol",
"it_riccardo_fasol": "it_riccardo_fasol",
"it": "it-riccardo_fasol-x-low",
#
"kazakh": "kk",
"kk": "kk_iseke",
"kk_iseke": "kk_iseke",
"kk_raya": "kk_raya",
"kk": "kk-iseke-x-low",
#
"nepali": "ne",
"ne": "ne_google",
"ne_google": "ne_google",
"ne": "ne-google-x-low",
#
"dutch": "nl",
"nl": "nl_rdh",
"nl_rdh": "nl_rdh",
"nl_nathalie": "nl_nathalie",
"nl": "nl-rdh-x-low",
#
"norwegian": "no",
"no": "no_talesynthese",
"no_talesynthese": "no_talesynthese",
"no": "no-talesyntese-medium",
#
"polish": "pl",
"pl": "pl-mls_6892-low",
#
"portuguese": "pt",
"pt": "pt-br",
"pt-br": "pt-br-edresson-low",
#
"ukrainian": "uk",
"uk": "uk_lada",
"uk_lada": "uk_lada",
"uk": "uk-lada-x-low",
#
"vietnamese": "vi",
"vi": "vi_vivos",
"vi_vivos": "vi_vivos",
"vi": "vi-25hours-single-low",
#
"chinese": "zh",
"zh": "zh-cn",
"zh-cn": "zh-cn-huayan-x-low",
}


Expand All @@ -85,6 +118,9 @@ def main() -> None:
default="https://github.com/rhasspy/piper/releases/download/v0.0.2/voice-{name}.tar.gz",
help="Format string for download URLs",
)
parser.add_argument(
"--dry-run", action="store_true", help="Don't actually download"
)
args = parser.parse_args()
logging.basicConfig(level=logging.INFO)

Expand All @@ -97,6 +133,9 @@ def main() -> None:

args.destination.parent.mkdir(parents=True, exist_ok=True)

for voice_name in _VOICE_NAMES:
_VOICES[voice_name] = voice_name

for name in args.name:
resolved_name = _VOICES[name]
while resolved_name != name:
Expand All @@ -105,6 +144,10 @@ def main() -> None:

url = args.link_format.format(name=name)
_LOGGER.info("Downloading %s", url)

if args.dry_run:
return

with urlopen(url) as response:
with tarfile.open(mode="r|*", fileobj=response) as tar_gz:
_LOGGER.info("Extracting to %s", args.destination)
Expand Down

0 comments on commit 11e8d30

Please sign in to comment.