From eea1f4b7b3e64e2eadae0de346b445f45aa1b3dc Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Fri, 25 Mar 2022 17:49:12 -0400 Subject: [PATCH] Fix SSML voice bug --- Makefile | 25 +++++++++++++++++++++++++ mimic3-tts/mimic3_tts/tts.py | 4 ++-- mimic3-tts/run.sh | 20 ++++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 Makefile create mode 100755 mimic3-tts/run.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2e100d0 --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +# Copyright 2022 Mycroft AI Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +.PHONY: dist + +dist: + cd opentts-abc && python3 setup.py sdist + cd mimic3-tts && python3 setup.py sdist + cd mimic3-http && python3 setup.py sdist + mkdir -p dist + cp opentts-abc/dist/opentts_abc-*.tar.gz dist/ + cp mimic3-tts/dist/mimic3_tts-*.tar.gz dist/ + cp mimic3-http/dist/mimic3_http-*.tar.gz dist/ diff --git a/mimic3-tts/mimic3_tts/tts.py b/mimic3-tts/mimic3_tts/tts.py index 497a5fc..d2162af 100644 --- a/mimic3-tts/mimic3_tts/tts.py +++ b/mimic3-tts/mimic3_tts/tts.py @@ -310,7 +310,7 @@ class Mimic3TextToSpeechSystem(TextToSpeechSystem): self._results.append(MarkResult(name=name)) def end_utterance(self) -> typing.Iterable[BaseResult]: - last_settings = self.settings + last_settings: typing.Optional[Mimic3Settings] = None sent_phonemes: PHONEMES_LIST_TYPE = [] @@ -356,7 +356,7 @@ class Mimic3TextToSpeechSystem(TextToSpeechSystem): audio = voice.ids_to_audio( sent_phoneme_ids, - speaker=self.speaker, + speaker=settings.speaker, length_scale=settings.length_scale, noise_scale=settings.noise_scale, noise_w=settings.noise_w, diff --git a/mimic3-tts/run.sh b/mimic3-tts/run.sh new file mode 100755 index 0000000..9f59531 --- /dev/null +++ b/mimic3-tts/run.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -eo pipefail + +# Directory of *this* script +this_dir="$( cd "$( dirname "$0" )" && pwd )" + +# Kebab to snake case +module_name="$(basename "${this_dir}" | sed -e 's/-/_/g')" +src_dir="${this_dir}/${module_name}" + +# Path to virtual environment +: "${venv:=${this_dir}/.venv}" + +if [ -d "${venv}" ]; then + # Activate virtual environment if available + source "${venv}/bin/activate" +fi + +export PYTHONPATH="${this_dir}" +python3 -m "${module_name}" "$@"