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/restore phonetic spellings #195

Merged
merged 15 commits into from
Apr 29, 2024
Merged

feat/restore phonetic spellings #195

merged 15 commits into from
Apr 29, 2024

Conversation

JarbasAl
Copy link
Member

@JarbasAl JarbasAl commented Dec 8, 2023

phonetic spellings used to refer to a hardcoded english file in mycroft-core specific to mimic1

now generalized to be per TTS plugin and live in a "locale" folder like everything else

example: OpenVoiceOS/ovos-tts-plugin-mimic#12

per lang/request support for phonetic-spellings 🎉

TTSContext has also been extended to fully encapsulate the request specific data (lang/voice/synth_kwargs)

class TTSContext:
    """
    A context manager for handling Text-To-Speech (TTS) operations and caching.

    Attributes:
        plugin_id (str): Identifier for the TTS plugin being used.
        lang (str): Language code for the TTS operation.
        voice (str): Identifier for the voice type in use.
        synth_kwargs (dict): Optional dictionary containing additional keyword arguments for the TTS synthesizer.

    Class Attributes:
        _caches (dict): A class-level dictionary acting as a cache store for different TTS contexts.
    """

TTS base class was cleaned up in the process

  • spit out g2p init into its own method
  • make preprocess_sentence public, as its useful for plugins to override
  • move cache to TTSContext (because it depends on voice/lang combo)
  • move methods around for readability and group them based on functionality, deprecated code at bottom of file (sorry for messing up the git diff!)
  • add deprecation warnings

@JarbasAl JarbasAl added the enhancement New feature or request label Dec 8, 2023
@JarbasAl JarbasAl requested a review from goldyfruit December 8, 2023 18:03
Copy link

codecov bot commented Dec 8, 2023

Codecov Report

Attention: Patch coverage is 0% with 256 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (dev@264cdf7). Click here to learn what that means.

❗ Current head 9757fa9 differs from pull request most recent head 3f77ce3. Consider uploading reports for the commit 3f77ce3 to get more accurate results

Files Patch % Lines
ovos_plugin_manager/templates/tts.py 0.00% 256 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##             dev    #195   +/-   ##
=====================================
  Coverage       ?   0.00%           
=====================================
  Files          ?      57           
  Lines          ?    3972           
  Branches       ?       0           
=====================================
  Hits           ?       0           
  Misses         ?    3972           
  Partials       ?       0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

ovos_plugin_manager/templates/tts.py Outdated Show resolved Hide resolved
ovos_plugin_manager/templates/tts.py Outdated Show resolved Hide resolved
ovos_plugin_manager/templates/tts.py Outdated Show resolved Hide resolved
ovos_plugin_manager/templates/tts.py Show resolved Hide resolved
@JarbasAl JarbasAl force-pushed the refactor/rm_cache branch from 19330e1 to 7eb3f03 Compare April 20, 2024 18:16
fix kwargs handling in synth method

move methods around for readability and group them based on functionality

add more deprecation warnings

lang from session

move cache to TTSContext
@JarbasAl JarbasAl force-pushed the refactor/rm_cache branch from 7030feb to 3bcfaf9 Compare April 20, 2024 18:26
@JarbasAl JarbasAl marked this pull request as ready for review April 20, 2024 19:00
@JarbasAl JarbasAl force-pushed the refactor/rm_cache branch from 094a541 to e8b6066 Compare April 20, 2024 19:59
@JarbasAl JarbasAl requested review from emphasize, NeonDaniel and a team April 20, 2024 20:08
JarbasAl added a commit to OpenVoiceOS/ovos-audio that referenced this pull request Apr 21, 2024
A hivemind satellite can listen for `speak` messages from master, emit 'speak:b64_audio', and listen for 'speak:b64_audio.response' with b64 encoded audio to play. eg, in a browser

counterpart to OpenVoiceOS/ovos-dinkum-listener#75

needs OpenVoiceOS/ovos-plugin-manager#195
JarbasAl added a commit to OpenVoiceOS/ovos-audio that referenced this pull request Apr 21, 2024
A hivemind satellite can listen for `speak` messages from master, emit 'speak:b64_audio', and listen for 'speak:b64_audio.response' with b64 encoded audio to play. eg, in a browser

counterpart to OpenVoiceOS/ovos-dinkum-listener#75

needs OpenVoiceOS/ovos-plugin-manager#195
@JarbasAl JarbasAl changed the title feat/tts_prefs refactor/TTSContext Apr 23, 2024
@goldyfruit
Copy link
Member

Apr 24 21:33:48 mark2 ovos-audio[15526]: Playing WAVE '/home/goldyfruit/.venvs/ovos/lib/python3.11/site-packages/ovos_audio/res/snd/start_listening.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Apr 24 21:33:51 mark2 ovos-audio[15302]: 2024-04-24 21:33:51.658 - audio - ovos_audio.audio:_restore_volume_after_record:309 - DEBUG - No audio service to restore volume of
Apr 24 21:33:51 mark2 ovos-audio[15302]: 2024-04-24 21:33:51.844 - audio - ovos_bus_client.client.client:on_default_session_update:161 - DEBUG - synced default_session
Apr 24 21:33:51 mark2 ovos-audio[15302]: 2024-04-24 21:33:51.923 - audio - ovos_audio.service:execute_tts:351 - INFO - Speak: It is nine thirty three
Apr 24 21:33:51 mark2 ovos-audio[15302]: 2024-04-24 21:33:51.926 - audio - ovos_plugin_manager.templates.tts:_get_ctxt:562 - DEBUG - TTS kwargs: {'lang': 'en-us'}
Apr 24 21:33:51 mark2 ovos-audio[15302]: 2024-04-24 21:33:51.939 - audio - ovos_plugin_manager.utils.tts_cache:load_persistent_cache:263 - INFO - Persistent TTS cache files loaded successfully.
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.296 - audio - ovos_plugin_manager.templates.tts:TTS.tts_id - WARNING - Deprecation version=0.1.0. Caller=ovos_audio.playback:92. self.tts_id has been deprecated, use TTSContext().tts_id
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.301 - audio - ovos_plugin_manager.templates.tts:_get_ctxt:562 - DEBUG - TTS kwargs: {}
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.306 - audio - ovos_plugin_manager.templates.tts:TTS.tts_id - WARNING - Deprecation version=0.1.0. Caller=ovos_audio.playback:94. self.tts_id has been deprecated, use TTSContext().tts_id
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.311 - audio - ovos_plugin_manager.templates.tts:_get_ctxt:562 - DEBUG - TTS kwargs: {}
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.319 - audio - ovos_plugin_manager.templates.tts:TTS.tts_id - WARNING - Deprecation version=0.1.0. Caller=ovos_audio.playback:92. self.tts_id has been deprecated, use TTSContext().tts_id
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.326 - audio - ovos_plugin_manager.templates.tts:_get_ctxt:562 - DEBUG - TTS kwargs: {'lang': 'en-us'}
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.329 - audio - ovos_plugin_manager.templates.tts:TTS.tts_id - WARNING - Deprecation version=0.1.0. Caller=ovos_audio.playback:94. self.tts_id has been deprecated, use TTSContext().tts_id
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.334 - audio - ovos_plugin_manager.templates.tts:_get_ctxt:562 - DEBUG - TTS kwargs: {'lang': 'en-us'}
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.352 - audio - ovos_bus_client.session:get:600 - DEBUG - No message, use default session
Apr 24 21:33:53 mark2 ovos-audio[15302]: 2024-04-24 21:33:53.907 - audio - ovos_plugin_manager.templates.tts:TTS.tts_id - WARNING - Deprecation version=0.1.0. Caller=ovos_audio.playback:92. self.tts_id has been deprecated, use TTSContext().tts_id
Apr 24 21:33:53 mark2 ovos-audio[15302]: 2024-04-24 21:33:53.912 - audio - ovos_plugin_manager.templates.tts:_get_ctxt:562 - DEBUG - TTS kwargs: {}
Apr 24 21:33:53 mark2 ovos-audio[15302]: 2024-04-24 21:33:53.916 - audio - ovos_plugin_manager.templates.tts:TTS.tts_id - WARNING - Deprecation version=0.1.0. Caller=ovos_audio.playback:94. self.tts_id has been deprecated, use TTSContext().tts_id
Apr 24 21:33:53 mark2 ovos-audio[15302]: 2024-04-24 21:33:53.920 - audio - ovos_plugin_manager.templates.tts:_get_ctxt:562 - DEBUG - TTS kwargs: {}
Apr 24 21:33:53 mark2 ovos-audio[15302]: 2024-04-24 21:33:53.926 - audio - ovos_plugin_manager.templates.tts:TTS.cache - WARNING - Deprecation version=0.1.0. Caller=ovos_audio.playback:153. self.cache has been deprecated, use TTSContext().get_cache
Apr 24 21:33:53 mark2 ovos-audio[15302]: 2024-04-24 21:33:53.928 - audio - ovos_plugin_manager.templates.tts:TTS.tts_id - WARNING - Deprecation version=0.1.0. Caller=ovos_audio.playback:153. self.tts_id has been deprecated, use TTSContext().tts_id
Apr 24 21:33:53 mark2 ovos-audio[15302]: 2024-04-24 21:33:53.933 - audio - ovos_plugin_manager.templates.tts:_get_ctxt:562 - DEBUG - TTS kwargs: {'lang': 'en-us'}

used to refer to a hardcoded nglish file in mycroft-core specific to mimic1

now generalized to be per TTS plugin and live in a "locale" folder like everything else
@JarbasAl JarbasAl changed the title refactor/TTSContext feat/restore phonetic spellings Apr 25, 2024
JarbasAl added a commit to OpenVoiceOS/ovos-audio that referenced this pull request Apr 25, 2024
remove all references to self.tts within the playback thread to simplify code, this does not break mycroft module compat as it was not present there

needs OpenVoiceOS/ovos-plugin-manager#195 for the cache cleaning
JarbasAl added a commit to OpenVoiceOS/ovos-audio that referenced this pull request Apr 25, 2024
remove all references to self.tts within the playback thread to simplify code, this does not break mycroft module compat as it was not present there

needs OpenVoiceOS/ovos-plugin-manager#195 for the cache cleaning
JarbasAl added a commit to OpenVoiceOS/ovos-tts-plugin-mimic that referenced this pull request Apr 25, 2024
JarbasAl added a commit to OpenVoiceOS/ovos-tts-plugin-mimic that referenced this pull request Apr 26, 2024
@JarbasAl
Copy link
Member Author

Apr 24 21:33:48 mark2 ovos-audio[15526]: Playing WAVE '/home/goldyfruit/.venvs/ovos/lib/python3.11/site-packages/ovos_audio/res/snd/start_listening.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Apr 24 21:33:51 mark2 ovos-audio[15302]: 2024-04-24 21:33:51.658 - audio - ovos_audio.audio:_restore_volume_after_record:309 - DEBUG - No audio service to restore volume of
Apr 24 21:33:51 mark2 ovos-audio[15302]: 2024-04-24 21:33:51.844 - audio - ovos_bus_client.client.client:on_default_session_update:161 - DEBUG - synced default_session
Apr 24 21:33:51 mark2 ovos-audio[15302]: 2024-04-24 21:33:51.923 - audio - ovos_audio.service:execute_tts:351 - INFO - Speak: It is nine thirty three
Apr 24 21:33:51 mark2 ovos-audio[15302]: 2024-04-24 21:33:51.926 - audio - ovos_plugin_manager.templates.tts:_get_ctxt:562 - DEBUG - TTS kwargs: {'lang': 'en-us'}
Apr 24 21:33:51 mark2 ovos-audio[15302]: 2024-04-24 21:33:51.939 - audio - ovos_plugin_manager.utils.tts_cache:load_persistent_cache:263 - INFO - Persistent TTS cache files loaded successfully.
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.296 - audio - ovos_plugin_manager.templates.tts:TTS.tts_id - WARNING - Deprecation version=0.1.0. Caller=ovos_audio.playback:92. self.tts_id has been deprecated, use TTSContext().tts_id
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.301 - audio - ovos_plugin_manager.templates.tts:_get_ctxt:562 - DEBUG - TTS kwargs: {}
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.306 - audio - ovos_plugin_manager.templates.tts:TTS.tts_id - WARNING - Deprecation version=0.1.0. Caller=ovos_audio.playback:94. self.tts_id has been deprecated, use TTSContext().tts_id
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.311 - audio - ovos_plugin_manager.templates.tts:_get_ctxt:562 - DEBUG - TTS kwargs: {}
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.319 - audio - ovos_plugin_manager.templates.tts:TTS.tts_id - WARNING - Deprecation version=0.1.0. Caller=ovos_audio.playback:92. self.tts_id has been deprecated, use TTSContext().tts_id
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.326 - audio - ovos_plugin_manager.templates.tts:_get_ctxt:562 - DEBUG - TTS kwargs: {'lang': 'en-us'}
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.329 - audio - ovos_plugin_manager.templates.tts:TTS.tts_id - WARNING - Deprecation version=0.1.0. Caller=ovos_audio.playback:94. self.tts_id has been deprecated, use TTSContext().tts_id
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.334 - audio - ovos_plugin_manager.templates.tts:_get_ctxt:562 - DEBUG - TTS kwargs: {'lang': 'en-us'}
Apr 24 21:33:52 mark2 ovos-audio[15302]: 2024-04-24 21:33:52.352 - audio - ovos_bus_client.session:get:600 - DEBUG - No message, use default session
Apr 24 21:33:53 mark2 ovos-audio[15302]: 2024-04-24 21:33:53.907 - audio - ovos_plugin_manager.templates.tts:TTS.tts_id - WARNING - Deprecation version=0.1.0. Caller=ovos_audio.playback:92. self.tts_id has been deprecated, use TTSContext().tts_id
Apr 24 21:33:53 mark2 ovos-audio[15302]: 2024-04-24 21:33:53.912 - audio - ovos_plugin_manager.templates.tts:_get_ctxt:562 - DEBUG - TTS kwargs: {}
Apr 24 21:33:53 mark2 ovos-audio[15302]: 2024-04-24 21:33:53.916 - audio - ovos_plugin_manager.templates.tts:TTS.tts_id - WARNING - Deprecation version=0.1.0. Caller=ovos_audio.playback:94. self.tts_id has been deprecated, use TTSContext().tts_id
Apr 24 21:33:53 mark2 ovos-audio[15302]: 2024-04-24 21:33:53.920 - audio - ovos_plugin_manager.templates.tts:_get_ctxt:562 - DEBUG - TTS kwargs: {}
Apr 24 21:33:53 mark2 ovos-audio[15302]: 2024-04-24 21:33:53.926 - audio - ovos_plugin_manager.templates.tts:TTS.cache - WARNING - Deprecation version=0.1.0. Caller=ovos_audio.playback:153. self.cache has been deprecated, use TTSContext().get_cache
Apr 24 21:33:53 mark2 ovos-audio[15302]: 2024-04-24 21:33:53.928 - audio - ovos_plugin_manager.templates.tts:TTS.tts_id - WARNING - Deprecation version=0.1.0. Caller=ovos_audio.playback:153. self.tts_id has been deprecated, use TTSContext().tts_id
Apr 24 21:33:53 mark2 ovos-audio[15302]: 2024-04-24 21:33:53.933 - audio - ovos_plugin_manager.templates.tts:_get_ctxt:562 - DEBUG - TTS kwargs: {'lang': 'en-us'}

fixed by OpenVoiceOS/ovos-audio#59

JarbasAl added a commit to OpenVoiceOS/ovos-audio that referenced this pull request Apr 29, 2024
* refactor/revert_ovos_additions_to_playback_thread

remove all references to self.tts within the playback thread to simplify code, this does not break mycroft module compat as it was not present there

needs OpenVoiceOS/ovos-plugin-manager#195 for the cache cleaning

* allow older OPM versions

* allow older OPM versions
@JarbasAl JarbasAl merged commit f29fed1 into dev Apr 29, 2024
8 checks passed
@JarbasAl JarbasAl deleted the refactor/rm_cache branch April 29, 2024 04:44
JarbasAl added a commit to OpenVoiceOS/ovos-audio that referenced this pull request Apr 29, 2024
* feat/b64_tts

A hivemind satellite can listen for `speak` messages from master, emit 'speak:b64_audio', and listen for 'speak:b64_audio.response' with b64 encoded audio to play. eg, in a browser

counterpart to OpenVoiceOS/ovos-dinkum-listener#75

needs OpenVoiceOS/ovos-plugin-manager#195

* Update ovos_audio/service.py

Co-authored-by: Mike <[email protected]>

* Update requirements.txt

---------

Co-authored-by: Mike <[email protected]>
JarbasAl added a commit that referenced this pull request Apr 30, 2024
missed in #195 refactor
@JarbasAl JarbasAl mentioned this pull request Apr 30, 2024
JarbasAl added a commit that referenced this pull request Apr 30, 2024
@JarbasAl JarbasAl mentioned this pull request May 1, 2024
@github-actions github-actions bot mentioned this pull request Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants