From 80982b5953c221ab25b4cd3f0cd1cd935261774f Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 26 Sep 2026 07:31:21 +0200 Subject: Use the system kokoro-onnx package, drop the venv kokoro-onnx is now packaged (python3-kokoro-onnx, without espeakng-loader) and finds the system espeak-ng with its default config, so the explicit EspeakConfig and the .venv setup go away. Tested live: two Italian questions answered and spoken correctly. Co-Authored-By: Claude Opus 5.5 --- .gitignore | 1 - AGENTS.md | 24 +++++------------------- README.md | 6 ++---- assistant.py | 10 +++------- 4 files changed, 10 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index a230a78..c18dd8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -.venv/ __pycache__/ diff --git a/AGENTS.md b/AGENTS.md index d53a530..bc01b7e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -7,12 +7,9 @@ the glue between them. Status: **first working loop** in `assistant.py` (2026-09-25). Mic button on/off is push-to-talk, whisper large-v3-turbo on the Arc transcribes, the resident llama-server model answers, Kokoro speaks it. Button-off to -first spoken word ~2 s. Kokoro is not packaged yet: it runs from the -repo's gitignored `.venv`. See "Findings" and "Next steps". +first spoken word ~2 s. See "Findings" and "Next steps". -Run: `.venv/bin/python assistant.py` (`--test` for the self-check). The -venv is `python3 -m venv --system-site-packages .venv && .venv/bin/pip -install kokoro-onnx`; system-site-packages gives it the system onnxruntime. +Run: `python3 assistant.py` (`--test` for the self-check). --- @@ -26,8 +23,7 @@ mic button ──> arecord ──> whisper-server (STT) ──> llama-server (LL |-------|---------------------|--------|-------| | STT | `whisper.cpp` 1.9.4 | `whisper-server` (also `whisper-stream`, `whisper-cli`) | SDL2 mic capture, ffmpeg decoding, Vulkan + OpenVINO backends | | LLM | `llama.cpp-vulkan` 0.5.0 | `llama-server` | already running as a system service, see below | -| TTS | none yet: `kokoro-onnx` from PyPI in `.venv` | | uses system `python3-onnxruntime` and `espeak-ng` | -| (TTS, unused) | `piper-tts` 1.7.0 | `piper-tts` | voices rejected by ear, see Findings | +| TTS | `python3-kokoro-onnx` 0.6.1 | (Python module) | uses system `python3-onnxruntime` and `espeak-ng`, no `espeakng-loader` | The three packages are in the `my-slackbuilds` repo (`../slackbuilds-superrepo/my-slackbuilds/`). Package-level changes (build @@ -98,13 +94,6 @@ router. It already records 16 kHz mono WAV and sends it as `input_audio` to audio-capable models, and parses `presets.ini`. Reuse its findings, do not import from it. -## piper-tts - -Prebuilt upstream wheel (OHF-voice/piper1-gpl), console script `piper-tts`, -Python module `piper` under the system python3.12. Runtime deps -`python3-onnxruntime` and `python3-pathvalidate` are packaged separately. -Voices are ONNX models plus a `.onnx.json` config; none downloaded yet. - --- ## Findings @@ -336,6 +325,8 @@ kokoro-onnx GitHub release `model-files-v1.0`. espeak-ng instead: `EspeakConfig(lib_path="/usr/lib64/libespeak-ng.so.1", data_path="/usr/share/espeak-ng-data")`. A system package would do the same and drop `espeakng-loader`. + Done 2026-09-26: `python3-kokoro-onnx` (with `python3-phonemizer`, + `python3-dlinfo`) finds system espeak-ng with the default config. - Load 0.30 s. `create()` on the ~20 s paragraph: ~2.6 s, ~7x real time, same for `if_sara`, `im_nicola` (lang `it`), `af_heart` (`en-us`), `bm_george` (`en-gb`). `create()` returns only after the whole text, so @@ -359,8 +350,6 @@ Steps 1-5 of the original plan are done (models, backend comparison, live mic, TTS, glue); push-to-talk came for free from the mic button. Open, in no particular order: -- **Packaging Kokoro** in `my-slackbuilds` (`kokoro-onnx` without - `espeakng-loader`, pointed at system espeak-ng), then drop `.venv`. - **Run as a service/autostart** (it currently runs by hand). - **Barge-in:** pressing the button while it speaks does not stop the reply yet. @@ -369,9 +358,6 @@ no particular order: - **Latency:** STT ~1.2 s is the biggest share; the double encoder pass (detect + transcribe) is the target if it matters. - **Tools** (time, weather, calendar) so the model stops guessing facts. -- Piper leftovers: piper voices and ggml-base/small deleted 2026-09-26. - Installed `piper-tts` and `python3-pathvalidate` packages still to remove - (root). - OpenVINO in the whisper.cpp package: runs on CPU only here (no Intel compute-runtime), decision goes to `my-slackbuilds`. diff --git a/README.md b/README.md index d9f4d28..ea51698 100644 --- a/README.md +++ b/README.md @@ -39,10 +39,8 @@ Paths, the card name and ports are constants at the top of `assistant.py`. ## Usage ```sh -python3 -m venv --system-site-packages .venv -.venv/bin/pip install kokoro-onnx -.venv/bin/python assistant.py # run -.venv/bin/python assistant.py --test # self-check +python3 assistant.py # run +python3 assistant.py --test # self-check ``` ## License diff --git a/assistant.py b/assistant.py index 49fb082..00c1081 100644 --- a/assistant.py +++ b/assistant.py @@ -17,7 +17,7 @@ """Mic button on: record. Mic button off: transcribe (whisper-server), ask the loaded llama-server model, speak the reply (Kokoro). -Run: .venv/bin/python assistant.py (--test runs the self-check) +Run: python3 assistant.py (--test runs the self-check) """ import ctypes @@ -134,12 +134,8 @@ def ask(messages): def speaker(q): - from kokoro_onnx import Kokoro, EspeakConfig - # The espeakng-loader wheel's bundled lib has a broken data path; use - # the system espeak-ng. - k = Kokoro(f"{MODELS}/kokoro/kokoro-v1.0.onnx", f"{MODELS}/kokoro/voices-v1.0.bin", - espeak_config=EspeakConfig(lib_path="/usr/lib64/libespeak-ng.so.1", - data_path="/usr/share/espeak-ng-data")) + from kokoro_onnx import Kokoro + k = Kokoro(f"{MODELS}/kokoro/kokoro-v1.0.onnx", f"{MODELS}/kokoro/voices-v1.0.bin") voices = {"it": 0.8 * k.get_voice_style("if_sara") + 0.2 * k.get_voice_style("af_bella"), "en": k.get_voice_style("af_heart")} play = None -- cgit v1.2.3