Skip to content

Commit

Permalink
Merge pull request #278 from OpenVoiceOS/release-0.5.3a1
Browse files Browse the repository at this point in the history
Release 0.5.3a1
  • Loading branch information
JarbasAl authored Oct 23, 2024
2 parents 6ec7ea1 + 7cc0934 commit acc424d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 48 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Changelog

## [0.5.2a1](https://github.com/OpenVoiceOS/ovos-plugin-manager/tree/0.5.2a1) (2024-10-21)
## [0.5.3a1](https://github.com/OpenVoiceOS/ovos-plugin-manager/tree/0.5.3a1) (2024-10-23)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-plugin-manager/compare/0.5.1...0.5.2a1)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-plugin-manager/compare/0.5.2...0.5.3a1)

**Merged pull requests:**

- fix:phal config loading [\#274](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/274) ([JarbasAl](https://github.com/JarbasAl))
- fix:deprecate G2P [\#277](https://github.com/OpenVoiceOS/ovos-plugin-manager/pull/277) ([JarbasAl](https://github.com/JarbasAl))



Expand Down
2 changes: 1 addition & 1 deletion ovos_plugin_manager/g2p.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Optional

from ovos_config import Configuration
from ovos_plugin_manager.utils import normalize_lang, PluginTypes, PluginConfigTypes
from ovos_plugin_manager.templates.g2p import Grapheme2PhonemePlugin, PhonemeAlphabet
from ovos_utils.log import LOG
Expand Down
51 changes: 9 additions & 42 deletions ovos_plugin_manager/templates/tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
from ovos_utils.log import LOG, deprecated, log_deprecation
from ovos_utils.metrics import Stopwatch
from ovos_utils.process_utils import RuntimeRequirements

from ovos_plugin_manager.g2p import OVOSG2PFactory, find_g2p_plugins
from ovos_plugin_manager.templates.g2p import OutOfVocabulary
from ovos_plugin_manager.utils.config import get_plugin_config
from ovos_plugin_manager.utils.tts_cache import TextToSpeechCache, hash_sentence

Expand Down Expand Up @@ -225,8 +222,6 @@ def __init__(self, lang=None, config=None, validator=None,
TTS.queue = Queue()

self.spellings: Dict[str, dict] = self.load_spellings()
self._init_g2p()

self.add_metric({"metric_type": "tts.init"})

# unused by plugins, assigned in init method by ovos-audio,
Expand All @@ -235,6 +230,15 @@ def __init__(self, lang=None, config=None, validator=None,

self._plugin_id = "" # the plugin name

@property
def g2p(self) -> None:
log_deprecation("G2P plugins moved to PlaybackThread in ovos-audio, self.g2p is deprecated!", "1.0.0")
return None

@g2p.setter
def g2p(self, val):
log_deprecation("G2P plugins moved to PlaybackThread in ovos-audio, self.g2p is deprecated!", "1.0.0")

@property
def plugin_id(self) -> str:
"""
Expand Down Expand Up @@ -409,28 +413,6 @@ def validate_ssml(self, utterance):
return utterance.replace(" ", " ")

# init helpers
def _init_g2p(self):
"""
Initializes the grapheme-to-phoneme (G2P) conversion for the TTS engine.
"""
cfg = Configuration()
g2pm = self.config.get("g2p_module")
if g2pm:
if g2pm in find_g2p_plugins():
cfg.setdefault("g2p", {})
globl = cfg["g2p"].get("module") or g2pm
if globl != g2pm:
LOG.info(f"TTS requested {g2pm} explicitly, ignoring global module {globl} ")
cfg["g2p"]["module"] = g2pm
else:
LOG.warning(f"TTS selected {g2pm}, but it is not available!")

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

def init(self, bus=None, playback=None):
""" Connects TTS object to PlaybackQueue in ovos-audio.
Expand Down Expand Up @@ -556,15 +538,6 @@ def _get_visemes(self, phonemes, sentence, ctxt):
viseme = []
if phonemes:
viseme = self.viseme(phonemes)
elif self.g2p is not None:
try:
viseme = self.g2p.utterance2visemes(sentence, ctxt.lang)
except OutOfVocabulary:
pass
except:
# this one is unplanned, let devs know all the info so they can fix it
LOG.exception(f"Unexpected failure in G2P plugin: {self.g2p}")

if not viseme:
# Debug level because this is expected in default installs
LOG.debug(f"no mouth movements available! unknown visemes for {sentence}")
Expand Down Expand Up @@ -717,12 +690,6 @@ def _cache_phonemes(self, sentence, lang: str, cache: TextToSpeechCache = None,
sentence_hash (str, optional): The hash of the sentence.
"""
sentence_hash = sentence_hash or hash_sentence(sentence)
if not phonemes and self.g2p is not None:
try:
phonemes = self.g2p.utterance2arpa(sentence, lang)
self.add_metric({"metric_type": "tts.phonemes.g2p"})
except Exception as e:
self.add_metric({"metric_type": "tts.phonemes.g2p.error", "error": str(e)})
if phonemes:
phoneme_file = cache.define_phoneme_file(sentence_hash)
phoneme_file.save(phonemes)
Expand Down
4 changes: 2 additions & 2 deletions ovos_plugin_manager/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# START_VERSION_BLOCK
VERSION_MAJOR = 0
VERSION_MINOR = 5
VERSION_BUILD = 2
VERSION_ALPHA = 0
VERSION_BUILD = 3
VERSION_ALPHA = 1
# END_VERSION_BLOCK

0 comments on commit acc424d

Please sign in to comment.