From 575e0e015a795da498a30fb3cf54b8cefbe83a86 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Thu, 27 Jul 2023 15:58:38 -0700 Subject: [PATCH 01/14] Update container config handling and resolve logged warnings (#173) # Description Set default XDG_CONFIG_HOME envvar in Dockerfile Update ovos-dinkum-listener dependency # Issues # Other Notes --- Dockerfile | 1 + requirements/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 709629d..eb50f4a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ LABEL vendor=neon.ai \ ENV OVOS_CONFIG_BASE_FOLDER neon ENV OVOS_CONFIG_FILENAME neon.yaml +ENV XDG_CONFIG_HOME /config RUN apt-get update && \ apt-get install -y \ diff --git a/requirements/requirements.txt b/requirements/requirements.txt index c65553f..4a4f873 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,4 +1,4 @@ -ovos-dinkum-listener~=0.0.2 +ovos-dinkum-listener~=0.0.2,>=0.0.3a1 ovos-bus-client~=0.0.3 ovos-utils~=0.0.30 ovos-plugin-manager~=0.0.23 From eca8087921c0edc41fd85e3bfc6a1224772611fc Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Thu, 27 Jul 2023 22:58:55 +0000 Subject: [PATCH 02/14] Increment Version to 4.1.1a1 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index 085223d..501553c 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "4.1.0" +__version__ = "4.1.1a1" From 2c84e319f8ede8f2f4807f6f3dea569c449636e9 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Thu, 27 Jul 2023 17:50:10 -0700 Subject: [PATCH 03/14] Kubernetes/No-audio server compat. (#174) # Description Add config option to disable listener and only run API methods for k8s deployment Handle read-only config file paths and fallback to `/tmp` for k8s compat. # Issues # Other Notes --- docker_overlay/etc/neon/neon.yaml | 1 + neon_speech/service.py | 26 ++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/docker_overlay/etc/neon/neon.yaml b/docker_overlay/etc/neon/neon.yaml index 7835100..34d2e6d 100644 --- a/docker_overlay/etc/neon/neon.yaml +++ b/docker_overlay/etc/neon/neon.yaml @@ -57,6 +57,7 @@ sounds: start_listening: snd/start_listening.wav end_listening: snd/end_listening.wav acknowledge: snd/acknowledge.mp3 + error: snd/error.mp3 MQ: server: mq.2021.us port: 5672 diff --git a/neon_speech/service.py b/neon_speech/service.py index df02f37..79f13dc 100644 --- a/neon_speech/service.py +++ b/neon_speech/service.py @@ -113,12 +113,16 @@ def __init__(self, ready_hook=on_ready, error_hook=on_error, init_signal_bus init_signal_bus(self.bus) init_signal_handlers() + try: + self._default_user = get_neon_user_config() + except PermissionError: + LOG.warning("Unable to get writable config path; fallback to /tmp") + self._default_user = get_neon_user_config("/tmp") - self._default_user = get_neon_user_config() self._default_user['user']['username'] = "local" self.lock = Lock() - + self._stop_service = Event() if self.config.get('listener', {}).get('enable_stt_api', True): self.api_stt = STTFactory.create(config=self.config, results_event=None) @@ -126,9 +130,27 @@ def __init__(self, ready_hook=on_ready, error_hook=on_error, LOG.info("Skipping api_stt init") self.api_stt = None + def run(self): + if self.config.get('listener', {}).get('enable_voice_loop', True): + OVOSDinkumVoiceService.run(self) + else: + LOG.info(f"Running without voice_loop") + self.register_event_handlers() + self.status.set_ready() + try: + self._stop_service.wait() + except KeyboardInterrupt: + self.status.set_stopping() + except Exception as e: + LOG.exception("voice_loop failed") + self.status.set_error(str(e)) + LOG.info("Service stopped") + self._after_stop() + def shutdown(self): LOG.info("Shutting Down") self.stop() + self._stop_service.set() def register_event_handlers(self): OVOSDinkumVoiceService.register_event_handlers(self) From 1aa200b090a5f95eaa0451ed4254e75ffd406025 Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Fri, 28 Jul 2023 00:50:30 +0000 Subject: [PATCH 04/14] Increment Version to 4.1.1a2 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index 501553c..ffac719 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "4.1.1a1" +__version__ = "4.1.1a2" From add84ac5183d3fc4be4ad122b4dbd16dab3ee56b Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Tue, 3 Oct 2023 13:55:17 -0700 Subject: [PATCH 05/14] Add timing metrics for minerva testing (#175) # Description Add `get_stt` timing metric for audio input # Issues https://github.com/NeonGeckoCom/neon-minerva/pull/3 # Other Notes Includes patch for https://github.com/microsoft/onnxruntime/issues/17631 Updates license tests for dependency with undefined MIT license --------- Co-authored-by: Daniel McKnight --- .github/workflows/license_tests.yml | 2 ++ neon_speech/service.py | 9 +++++++-- requirements/docker.txt | 2 ++ requirements/test_requirements.txt | 3 ++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/license_tests.yml b/.github/workflows/license_tests.yml index 7d0c4f6..c57fbca 100644 --- a/.github/workflows/license_tests.yml +++ b/.github/workflows/license_tests.yml @@ -8,3 +8,5 @@ on: jobs: license_tests: uses: neongeckocom/.github/.github/workflows/license_tests.yml@master + with: + packages-exclude: '^(precise-runner|fann2|tqdm|bs4|ovos-phal-plugin|ovos-skill|neon-core|nvidia|neon-phal-plugin|bitstruct|audioread).*' diff --git a/neon_speech/service.py b/neon_speech/service.py index 79f13dc..44ce694 100644 --- a/neon_speech/service.py +++ b/neon_speech/service.py @@ -37,6 +37,7 @@ from neon_utils.file_utils import decode_base64_string_to_file from ovos_utils.log import LOG from neon_utils.configuration_utils import get_neon_user_config +from neon_utils.metrics_utils import Stopwatch from neon_utils.user_utils import apply_local_user_profile_updates from ovos_bus_client import Message from ovos_config.config import update_mycroft_config @@ -79,6 +80,8 @@ def on_started(): class NeonSpeechClient(OVOSDinkumVoiceService): + _stopwatch = Stopwatch("get_stt") + def __init__(self, ready_hook=on_ready, error_hook=on_error, stopping_hook=on_stopping, alive_hook=on_alive, started_hook=on_started, watchdog=lambda: None, @@ -372,10 +375,12 @@ def build_context(msg: Message): wav_file_path = message.data.get("audio_file") lang = message.data.get("lang") try: - _, parser_data, transcriptions = \ - self._get_stt_from_file(wav_file_path, lang) + with self._stopwatch: + _, parser_data, transcriptions = \ + self._get_stt_from_file(wav_file_path, lang) message.context["audio_parser_data"] = parser_data context = build_context(message) + context['timing']['get_stt'] = self._stopwatch.time data = { "utterances": transcriptions, "lang": message.data.get("lang", "en-us") diff --git a/requirements/docker.txt b/requirements/docker.txt index 37f32e8..bb0aae8 100644 --- a/requirements/docker.txt +++ b/requirements/docker.txt @@ -1,5 +1,7 @@ ovos-stt-plugin-vosk~=0.1 neon-stt-plugin-nemo~=0.0.2 +onnxruntime!=1.16.0 # TODO: Patching https://github.com/microsoft/onnxruntime/issues/17631 + # Load alternative WW plugins so they are available ovos-ww-plugin-pocketsphinx~=0.1 ovos-ww-plugin-precise-lite~=0.1 diff --git a/requirements/test_requirements.txt b/requirements/test_requirements.txt index ea60ae7..94bb8f2 100644 --- a/requirements/test_requirements.txt +++ b/requirements/test_requirements.txt @@ -5,4 +5,5 @@ ovos-stt-plugin-server~=0.0.3 pytest mock~=4.0 pydub~=0.23 -SpeechRecognition~=3.8 \ No newline at end of file +SpeechRecognition~=3.8 +onnxruntime!=1.16.0 # TODO: Patching https://github.com/microsoft/onnxruntime/issues/17631 From 960156c24ab9bfd66e5ddf25fc05bec38d5489e8 Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Tue, 3 Oct 2023 20:55:35 +0000 Subject: [PATCH 06/14] Increment Version to 4.1.1a3 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index ffac719..a63140e 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "4.1.1a2" +__version__ = "4.1.1a3" From 9f5a6ceb1be367c837046beffb5850e9507aef83 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Thu, 12 Oct 2023 18:17:17 -0700 Subject: [PATCH 07/14] Update Dinkum Listener dependency (#176) # Description Update dependencies for compat. with https://github.com/OpenVoiceOS/ovos-dinkum-listener/pull/67 # Issues Needs https://github.com/OpenVoiceOS/ovos-dinkum-listener/pull/67 # Other Notes --------- Co-authored-by: Daniel McKnight --- requirements/requirements.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 4a4f873..b3a701f 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,4 +1,4 @@ -ovos-dinkum-listener~=0.0.2,>=0.0.3a1 +ovos-dinkum-listener~=0.0.2,>=0.0.3a13 ovos-bus-client~=0.0.3 ovos-utils~=0.0.30 ovos-plugin-manager~=0.0.23 @@ -8,4 +8,5 @@ neon-utils[network,audio]~=1.6 ovos-config~=0.0.7 ovos-vad-plugin-webrtcvad~=0.0.1 -ovos-ww-plugin-vosk~=0.1 \ No newline at end of file +ovos-ww-plugin-vosk~=0.1 +ovos-microphone-plugin-alsa~=0.0.0 \ No newline at end of file From c64e10a47bc8408d665b67cbe77722b98ad2824b Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Fri, 13 Oct 2023 01:17:33 +0000 Subject: [PATCH 08/14] Increment Version to 4.1.1a4 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index a63140e..79d33b9 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "4.1.1a3" +__version__ = "4.1.1a4" From 2af9159470adb3f23f8ca0ab669a7cb9ec5fcfc3 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Wed, 25 Oct 2023 18:46:02 -0700 Subject: [PATCH 09/14] Stable dependencies for release (#177) # Description Test with stable dependencies in Dinkum listener # Issues https://github.com/OpenVoiceOS/ovos-dinkum-listener/pull/69 # Other Notes --------- Co-authored-by: Daniel McKnight --- requirements/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index b3a701f..44c5c1c 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,4 +1,4 @@ -ovos-dinkum-listener~=0.0.2,>=0.0.3a13 +ovos-dinkum-listener~=0.0.2,>=0.0.3a16 ovos-bus-client~=0.0.3 ovos-utils~=0.0.30 ovos-plugin-manager~=0.0.23 From 37076debffe42b277488f8a32371233cde09af16 Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Thu, 26 Oct 2023 01:46:21 +0000 Subject: [PATCH 10/14] Increment Version to 4.1.1a5 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index 79d33b9..0509b9e 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "4.1.1a4" +__version__ = "4.1.1a5" From e311722f01d1e439e605a1cd8ca57da58022869d Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Thu, 26 Oct 2023 13:04:11 -0700 Subject: [PATCH 11/14] OVOS Dinkum Listener Backwards Compat (#178) # Description Override source/destination validation for backwards-compat. with deprecation notice Pin ovos-dinkum-listener dependency for stable release # Issues # Other Notes --------- Co-authored-by: Daniel McKnight --- neon_speech/service.py | 11 ++++++++++- requirements/requirements.txt | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/neon_speech/service.py b/neon_speech/service.py index 44ce694..769842b 100644 --- a/neon_speech/service.py +++ b/neon_speech/service.py @@ -35,7 +35,7 @@ from pydub import AudioSegment from speech_recognition import AudioData from neon_utils.file_utils import decode_base64_string_to_file -from ovos_utils.log import LOG +from ovos_utils.log import LOG, log_deprecation from neon_utils.configuration_utils import get_neon_user_config from neon_utils.metrics_utils import Stopwatch from neon_utils.user_utils import apply_local_user_profile_updates @@ -133,6 +133,15 @@ def __init__(self, ready_hook=on_ready, error_hook=on_error, LOG.info("Skipping api_stt init") self.api_stt = None + def _validate_message_context(self, message: Message, native_sources=None): + if message.context.get('destination') and \ + "audio" not in message.context['destination']: + log_deprecation(f"Adding audio to destination context for " + f"{message.msg_type}", "5.0.0") + message.context['destination'].append('audio') + return OVOSDinkumVoiceService._validate_message_context(self, message, + native_sources) + def run(self): if self.config.get('listener', {}).get('enable_voice_loop', True): OVOSDinkumVoiceService.run(self) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 44c5c1c..c9f6b97 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,4 +1,4 @@ -ovos-dinkum-listener~=0.0.2,>=0.0.3a16 +ovos-dinkum-listener==0.0.3a16 ovos-bus-client~=0.0.3 ovos-utils~=0.0.30 ovos-plugin-manager~=0.0.23 From 29be7af75d6ac484048a75af1ac562040c322f18 Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Thu, 26 Oct 2023 20:04:30 +0000 Subject: [PATCH 12/14] Increment Version to 4.1.1a6 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index 0509b9e..64de7e1 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "4.1.1a5" +__version__ = "4.1.1a6" From e0db5f3bbf0b06143f895b812214e0aeaa12cf04 Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Fri, 27 Oct 2023 00:52:38 +0000 Subject: [PATCH 13/14] Increment Version to 4.2.0 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index 64de7e1..de7eb74 100644 --- a/version.py +++ b/version.py @@ -26,4 +26,4 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = "4.1.1a6" +__version__ = "4.2.0" From 3e59dbf0f39f9bdaae7044dd64a014a1f84088cc Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Fri, 27 Oct 2023 00:53:18 +0000 Subject: [PATCH 14/14] Update Changelog --- CHANGELOG.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f59cf3..f4e306b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,20 +1,60 @@ # Changelog -## [4.0.1a2](https://github.com/NeonGeckoCom/neon_speech/tree/4.0.1a2) (2023-07-18) +## [4.2.0](https://github.com/NeonGeckoCom/neon_speech/tree/4.2.0) (2023-10-27) -[Full Changelog](https://github.com/NeonGeckoCom/neon_speech/compare/4.0.1a1...4.0.1a2) +[Full Changelog](https://github.com/NeonGeckoCom/neon_speech/compare/4.1.1a6...4.2.0) + +**Fixed bugs:** + +- \[BUG\] Docker `start_listening` resource missing [\#170](https://github.com/NeonGeckoCom/neon_speech/issues/170) + +## [4.1.1a6](https://github.com/NeonGeckoCom/neon_speech/tree/4.1.1a6) (2023-10-26) + +[Full Changelog](https://github.com/NeonGeckoCom/neon_speech/compare/4.1.1a5...4.1.1a6) + +**Merged pull requests:** + +- OVOS Dinkum Listener Backwards Compat [\#178](https://github.com/NeonGeckoCom/neon_speech/pull/178) ([NeonDaniel](https://github.com/NeonDaniel)) + +## [4.1.1a5](https://github.com/NeonGeckoCom/neon_speech/tree/4.1.1a5) (2023-10-26) + +[Full Changelog](https://github.com/NeonGeckoCom/neon_speech/compare/4.1.1a4...4.1.1a5) + +**Merged pull requests:** + +- Stable dependencies for release [\#177](https://github.com/NeonGeckoCom/neon_speech/pull/177) ([NeonDaniel](https://github.com/NeonDaniel)) + +## [4.1.1a4](https://github.com/NeonGeckoCom/neon_speech/tree/4.1.1a4) (2023-10-13) + +[Full Changelog](https://github.com/NeonGeckoCom/neon_speech/compare/4.1.1a3...4.1.1a4) + +**Merged pull requests:** + +- Update Dinkum Listener dependency [\#176](https://github.com/NeonGeckoCom/neon_speech/pull/176) ([NeonDaniel](https://github.com/NeonDaniel)) + +## [4.1.1a3](https://github.com/NeonGeckoCom/neon_speech/tree/4.1.1a3) (2023-10-03) + +[Full Changelog](https://github.com/NeonGeckoCom/neon_speech/compare/4.1.1a2...4.1.1a3) + +**Merged pull requests:** + +- Add timing metrics for minerva testing [\#175](https://github.com/NeonGeckoCom/neon_speech/pull/175) ([NeonDaniel](https://github.com/NeonDaniel)) + +## [4.1.1a2](https://github.com/NeonGeckoCom/neon_speech/tree/4.1.1a2) (2023-07-28) + +[Full Changelog](https://github.com/NeonGeckoCom/neon_speech/compare/4.1.1a1...4.1.1a2) **Merged pull requests:** -- Update dependencies and mark deprecation [\#171](https://github.com/NeonGeckoCom/neon_speech/pull/171) ([NeonDaniel](https://github.com/NeonDaniel)) +- Kubernetes/No-audio server compat. [\#174](https://github.com/NeonGeckoCom/neon_speech/pull/174) ([NeonDaniel](https://github.com/NeonDaniel)) -## [4.0.1a1](https://github.com/NeonGeckoCom/neon_speech/tree/4.0.1a1) (2023-06-27) +## [4.1.1a1](https://github.com/NeonGeckoCom/neon_speech/tree/4.1.1a1) (2023-07-27) -[Full Changelog](https://github.com/NeonGeckoCom/neon_speech/compare/4.0.0...4.0.1a1) +[Full Changelog](https://github.com/NeonGeckoCom/neon_speech/compare/4.1.0...4.1.1a1) **Merged pull requests:** -- Update Docker to use OVOS\_CONFIG envvars [\#169](https://github.com/NeonGeckoCom/neon_speech/pull/169) ([NeonDaniel](https://github.com/NeonDaniel)) +- Update container config handling and resolve logged warnings [\#173](https://github.com/NeonGeckoCom/neon_speech/pull/173) ([NeonDaniel](https://github.com/NeonDaniel))