Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/optional_g2p #169

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions ovos_plugin_manager/templates/tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,13 @@ def __init__(self, lang="en-us", config=None, validator=None,
cfg["g2p"]["module"] = g2pm
else:
LOG.warning(f"TTS selected {g2pm}, but it is not available!")
self.g2p = OVOSG2PFactory.create(cfg)

try:
self.g2p = OVOSG2PFactory.create(cfg)
except:
LOG.exception("G2P plugin not loaded, there will be no mouth movements")
self.g2p = None

self.cache.curate()

self.add_metric({"metric_type": "tts.init"})
Expand Down Expand Up @@ -744,10 +750,10 @@ def _execute(self, sentence, ident, listen, **kwargs):
audio_file, phonemes = self.synth(sentence, **kwargs)

# get visemes/mouth movements
viseme = []
if phonemes:
viseme = self.viseme(phonemes)
else:
viseme = []
elif self.g2p is not None:
try:
viseme = self.g2p.utterance2visemes(sentence, lang)
except OutOfVocabulary:
Expand Down Expand Up @@ -811,7 +817,7 @@ def synth(self, sentence, **kwargs):

def _cache_phonemes(self, sentence, phonemes=None, sentence_hash=None):
sentence_hash = sentence_hash or hash_sentence(sentence)
if not phonemes:
if not phonemes and self.g2p is not None:
try:
phonemes = self.g2p.utterance2arpa(sentence, self.lang)
self.add_metric({"metric_type": "tts.phonemes.g2p"})
Expand Down
Loading