Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

chore(i18n): translate German to English in TTS/wake plugins

Ruben Lütke91326414d993
diff --git a/jarvis/plugins/tts/grok_voice_tts.py b/jarvis/plugins/tts/grok_voice_tts.py
index 9b32f728e3..120087d1d5 100644
--- a/jarvis/plugins/tts/grok_voice_tts.py
+++ b/jarvis/plugins/tts/grok_voice_tts.py
@@ -1,28 +1,28 @@
"""xAI Grok Voice TTS Plugin (Launch April 2026, "Think Fast 1.0").
-Nutzt den Unary-Endpoint `POST https://api.x.ai/v1/tts` mit Bearer-Auth.
-Wir requesten **rohes PCM 24 kHz mono int16** — identisch zum Gemini-/
-ElevenLabs-Pfad, damit der `sounddevice`-Playback nichts anpassen muss
-und kein MP3-Decoder noetig ist.
-
-Stimmen-Whitelist:
- - leo — authoritativ, kommandoartig (JARVIS-Default, Butler-Pendant
- zu ElevenLabs "Daniel" / Gemini "Charon")
- - rex — Business-Confident
+Uses the unary endpoint `POST https://api.x.ai/v1/tts` with bearer auth.
+We request **raw PCM 24 kHz mono int16** — identical to the Gemini /
+ElevenLabs path, so the `sounddevice` playback needs no adjustment
+and no MP3 decoder is needed.
+
+Voice whitelist:
+ - leo — authoritative, command-like (JARVIS default, butler counterpart
+ to ElevenLabs "Daniel" / Gemini "Charon")
+ - rex — business-confident
- sal — neutral, balanced
- - ara — warm, freundlich
- - eve — energisch (xAI-Default)
+ - ara — warm, friendly
+ - eve — energetic (xAI default)
Streaming:
- Echtes WebSocket-Streaming gibt es bei xAI (`wss://api.x.ai/v1/tts`),
- fuer Jarvis reicht Pseudo-Streaming via Satz-Chunking — analog zu
- GeminiFlashTTS: alle Saetze parallel in Flight, in Original-Reihenfolge
- yielden. Erste-Chunk-Latenz dominiert, Saetze 2..N sind synthetisiert
- bevor Satz 1 zu Ende gespielt ist.
-
-Fallback-Kette bei Fehlern (Quota / Auth / Netzwerk):
- Grok-Voice → Gemini-TTS → SAPI5 (Windows native, Quota-frei)
-Die Gemini-/SAPI5-Helpers werden aus `gemini_flash_tts` wiederverwendet.
+ Real WebSocket streaming exists at xAI (`wss://api.x.ai/v1/tts`), but for
+ Jarvis pseudo-streaming via sentence chunking is enough — analogous to
+ GeminiFlashTTS: all sentences in flight in parallel, yielded in original
+ order. First-chunk latency dominates; sentences 2..N are already
+ synthesized before sentence 1 finishes playing.
+
+Fallback chain on errors (quota / auth / network):
+ Grok Voice → Gemini TTS → SAPI5 (Windows native, no quota)
+The Gemini / SAPI5 helpers are reused from `gemini_flash_tts`.
"""
from __future__ import annotations
@@ -40,19 +40,19 @@ from jarvis.plugins.tts.gemini_flash_tts import (
_sapi5_synthesize,
)
-# xAI liefert PCM in 16-bit signed little-endian mono — gleiches Format
-# wie Gemini-TTS (`audio/l16; rate=24000`) und ElevenLabs (`pcm_24000`).
+# xAI delivers PCM as 16-bit signed little-endian mono — the same format
+# as Gemini TTS (`audio/l16; rate=24000`) and ElevenLabs (`pcm_24000`).
GROK_TTS_SAMPLE_RATE = 24_000
GROK_TTS_ENDPOINT = "https://api.x.ai/v1/tts"
_HTTP_TIMEOUT_S = 30.0
_QUOTA_COOLDOWN_S = 900.0
-# xAI-Limit: max 15 000 Zeichen pro Unary-Request. Wir splitten ohnehin
-# satzweise, ein einzelner Satz erreicht das Limit praktisch nie.
+# xAI limit: max 15,000 characters per unary request. We split by sentence
+# anyway, so a single sentence practically never reaches the limit.
_MAX_CHARS_PER_REQUEST = 15_000
-# 5 Voices laut Launch-Blog (April 2026). JARVIS-Default = "leo"
-# (authoritativ, kommandoartig — passt zum Butler-Pattern).
+# 5 voices per the launch blog (April 2026). JARVIS default = "leo"
+# (authoritative, command-like — fits the butler pattern).
GROK_VOICE_LEO = "leo"
GROK_VOICE_REX = "rex"
GROK_VOICE_SAL = "sal"
@@ -67,15 +67,15 @@ DEFAULT_VOICES: tuple[str, ...] = (
GROK_VOICE_EVE,
)
-# Satz-Splitter: identisch zu GeminiFlashTTS — DE+EN-Capital-Lookahead.
+# Sentence splitter: identical to GeminiFlashTTS — DE+EN capital lookahead.
_SENTENCE_END = re.compile(r"(?<=[.!?…])\s+(?=[A-ZÄÖÜ])")
class GrokVoiceTTS:
- """TTS-Provider fuer xAI Grok Voice (api.x.ai/v1/tts).
+ """TTS provider for xAI Grok Voice (api.x.ai/v1/tts).
- Strukturell kompatibel zum `TTSProvider`-Protocol — kein Vererben aus
- `jarvis.*` noetig (entry_point-Discovery-Pattern).
+ Structurally compatible with the `TTSProvider` protocol — no need to
+ inherit from `jarvis.*` (entry_point discovery pattern).
"""
name = "grok-voice"
@@ -91,12 +91,12 @@ class GrokVoiceTTS:
optimize_streaming_latency: int = 1,
allow_sapi5_fallback: bool = False,
) -> None:
- # Voice-Mismatch-Schutz: ein vom Gemini-Profil uebernommener Voice-
- # Name wie "Charon" wuerde xAI mit HTTP 400 quittieren. Wir weisen
- # auf den Default zurueck und loggen den Override sichtbar.
+ # Voice-mismatch protection: a voice name like "Charon" carried over
+ # from the Gemini profile would make xAI respond with HTTP 400. We
+ # fall back to the default and log the override visibly.
if default_voice not in DEFAULT_VOICES:
logging.getLogger("jarvis.tts.grok-voice").warning(
- "Voice %r ist kein Grok-Voice (erwartet: %s). Nutze Default %r.",
+ "Voice %r is not a Grok voice (expected: %s). Using default %r.",
default_voice, ", ".join(DEFAULT_VOICES), GROK_VOICE_LEO,
)
default_voice = GROK_VOICE_LEO
@@ -115,12 +115,12 @@ class GrokVoiceTTS:
# ------------------------------------------------------------------
def _resolve_api_key(self) -> str:
- """Single-Key-Policy: xAI nutzt einen Token fuer Brain + Voice.
+ """Single-key policy: xAI uses one token for brain + voice.
- Reihenfolge:
- 1. `xai_api_key` / ENV `XAI_API_KEY` (xAI-Doku-Default)
- 2. `grok_api_key` / ENV `GROK_API_KEY` (Jarvis-Wizard-Slot,
- gleichzeitig vom Grok-Brain-Plugin genutzt)
+ Order:
+ 1. `xai_api_key` / ENV `XAI_API_KEY` (xAI doc default)
+ 2. `grok_api_key` / ENV `GROK_API_KEY` (Jarvis wizard slot,
+ also used by the Grok brain plugin)
"""
for key, env in (
("xai_api_key", "XAI_API_KEY"),
@@ -130,8 +130,8 @@ class GrokVoiceTTS:
if val:
return val
raise RuntimeError(
- "xAI-API-Key nicht gefunden. Setze GROK_API_KEY oder XAI_API_KEY "
- "im Windows Credential Manager oder in der .env."
+ "xAI API key not found. Set GROK_API_KEY or XAI_API_KEY "
+ "in the Windows Credential Manager or in .env."
)
def _ensure_client(self) -> None:
@@ -148,7 +148,7 @@ class GrokVoiceTTS:
)
async def aclose(self) -> None:
- """Schliesst den HTTP-Client. Idempotent."""
+ """Closes the HTTP client. Idempotent."""
if self._client is not None:
try:
await self._client.aclose()
@@ -165,12 +165,12 @@ class GrokVoiceTTS:
voice: str | None = None,
language_code: str | None = None,
) -> AsyncIterator[AudioChunk]:
- """Synthetisiert Audio, yielded AudioChunks satz-weise.
+ """Synthesizes audio, yielding AudioChunks sentence by sentence.
- Multilingual: `language="auto"` ist xAI-Default und detektiert die
- Sprache aus dem Text. Wer hart pinnen will, gibt `language_code`
- als BCP-47 mit (`de-DE`, `en-US`); wir reichen das normalisiert
- an die API durch.
+ Multilingual: `language="auto"` is the xAI default and detects the
+ language from the text. Anyone wanting a hard pin passes `language_code`
+ as BCP-47 (`de-DE`, `en-US`); we pass it through normalized
+ to the API.
"""
text = text.strip()
if not text:
@@ -179,7 +179,7 @@ class GrokVoiceTTS:
voice = voice or self._default_voice
log = logging.getLogger("jarvis.tts.grok-voice")
- # Cooldown aktiv? Erst Gemini, dann SAPI5 — niemals stumm bleiben.
+ # Cooldown active? First Gemini, then SAPI5 — never stay silent.
if self._quota_blocked_until and time.monotonic() < self._quota_blocked_until:
async for chunk in self._fallback(text, language_code):
yield chunk
@@ -188,7 +188,7 @@ class GrokVoiceTTS:
try:
self._ensure_client()
except RuntimeError as exc:
- log.warning("Grok-Voice nicht initialisierbar (%s) — Fallback.", exc)
+ log.warning("Grok Voice could not be initialized (%s) — falling back.", exc)
async for chunk in self._fallback(text, language_code):
yield chunk
return
@@ -199,7 +199,7 @@ class GrokVoiceTTS:
if not sentences:
return
- # Alle Saetze parallel in Flight, Original-Reihenfolge yielden.
+ # All sentences in flight in parallel, yielded in original order.
tasks = [
asyncio.create_task(self._synthesize_one(s, voice, language_code))
for s in sentences
@@ -209,17 +209,17 @@ class GrokVoiceTTS:
try:
pcm = await task
except _GrokFatalError as exc:
- # 401/403/429 → Cooldown setzen, restliche Tasks abbrechen,
- # Fallback fuer den Rest des Textes.
+ # 401/403/429 → arm the cooldown, cancel remaining tasks,
+ # fall back for the rest of the text.
self._quota_blocked_until = time.monotonic() + _QUOTA_COOLDOWN_S
log.warning(
- "Grok-Voice Quota/Auth-Fehler (%s) — Fallback fuer %.0f min.",
+ "Grok Voice quota/auth error (%s) — falling back for %.0f min.",
exc, _QUOTA_COOLDOWN_S / 60,
)
for t in tasks[i + 1 :]:
t.cancel()
await asyncio.gather(*tasks[i + 1 :], return_exceptions=True)
- # Restlichen Text via Fallback-Chain ausspielen.
+ # Play out the remaining text via the fallback chain.
remainder = " ".join(sentences[i:])
async for chunk in self._fallback(remainder, language_code):
yield chunk
@@ -234,10 +234,10 @@ class GrokVoiceTTS:
channels=1,
)
elif self._allow_sapi5_fallback:
- # Einzelner Satz leer und Notbremse erlaubt: SAPI5 fuer genau
- # diesen Satz, damit der Flow nicht abreisst.
+ # Single sentence empty and the emergency brake is allowed:
+ # SAPI5 for exactly this sentence, so the flow doesn't break.
log.warning(
- "Grok-Voice leer fuer Satz %d/%d — SAPI5-Notbremse aktiv.",
+ "Grok Voice empty for sentence %d/%d — SAPI5 emergency brake active.",
i + 1, len(tasks),
)
fallback_pcm = await asyncio.to_thread(
@@ -252,22 +252,22 @@ class GrokVoiceTTS:
)
else:
log.error(
- "Grok-Voice lieferte kein Audio fuer Satz %d/%d (%r) — "
- "SAPI5-Fallback deaktiviert (tts.allow_sapi5_fallback=false). "
- "Audio fuer diesen Satz bleibt stumm.",
+ "Grok Voice returned no audio for sentence %d/%d (%r) — "
+ "SAPI5 fallback disabled (tts.allow_sapi5_fallback=false). "
+ "Audio stays silent for this sentence.",
i + 1, len(tasks), sentences[i][:80],
)
if not any_success:
log.error(
- "Grok-Voice lieferte keinerlei Audio fuer den gesamten Text. "
- "Versuche Cross-Provider-Fallback.",
+ "Grok Voice returned no audio at all for the whole text. "
+ "Trying cross-provider fallback.",
)
async for chunk in self._fallback(text, language_code):
yield chunk
def list_voices(self, language: str | None = None) -> list[str]:
- """5 Whitelisted Voices, alle multilingual (20+ Sprachen)."""
+ """5 whitelisted voices, all multilingual (20+ languages)."""
return list(DEFAULT_VOICES)
# ------------------------------------------------------------------
@@ -280,10 +280,10 @@ class GrokVoiceTTS:
voice: str,
language_code: str | None,
) -> bytes:
- """Ein Unary-POST an /v1/tts. Returnt rohes PCM oder b"" bei Soft-Error.
+ """A single unary POST to /v1/tts. Returns raw PCM or b"" on a soft error.
- Raised `_GrokFatalError` bei 401/403/429, damit der Caller den
- Cooldown setzen und auf Fallback umschalten kann.
+ Raises `_GrokFatalError` on 401/403/429, so the caller can arm the
+ cooldown and switch to the fallback.
"""
log = logging.getLogger("jarvis.tts.grok-voice")
text = text[:_MAX_CHARS_PER_REQUEST]
@@ -300,49 +300,49 @@ class GrokVoiceTTS:
"text_normalization": self._text_normalization,
}
if self._speed != 1.0:
- # `speed` ist nicht offiziell dokumentiert (Stand 2026-04-25),
- # aber inline-Speed-Tags werden vom Modell akzeptiert. Wir
- # legen das Feld trotzdem mit, falls die API es spaeter ergaenzt.
+ # `speed` is not officially documented (as of 2026-04-25),
+ # but inline speed tags are accepted by the model. We
+ # include the field anyway in case the API adds it later.
payload["speed"] = self._speed
assert self._client is not None
try:
resp = await self._client.post(GROK_TTS_ENDPOINT, json=payload)
except Exception as exc: # noqa: BLE001
- log.warning("Grok-Voice HTTP-Fehler (%s) — Soft-Fail.", exc.__class__.__name__)
+ log.warning("Grok Voice HTTP error (%s) — soft fail.", exc.__class__.__name__)
return b""
if resp.status_code in (401, 403, 429):
raise _GrokFatalError(f"HTTP {resp.status_code}")
if resp.status_code >= 400:
- # 400/500 — meist transient oder Schema-Mismatch. Loggen, b""
- # zurueck, der Caller faellt auf SAPI5 zurueck. Body nur erste
- # 200 Zeichen mitloggen, oft JSON-Error.
+ # 400/500 — usually transient or a schema mismatch. Log it, return
+ # b"" so the caller falls back to SAPI5. Only log the first
+ # 200 characters of the body, often a JSON error.
body = resp.text[:200] if resp.text else "<empty>"
log.warning(
- "Grok-Voice HTTP %d — voice=%s text=%r body=%s",
+ "Grok Voice HTTP %d — voice=%s text=%r body=%s",
resp.status_code, voice, text[:80], body,
)
return b""
data = resp.content
if not data:
- log.warning("Grok-Voice 200 OK aber leerer Body — voice=%s", voice)
+ log.warning("Grok Voice 200 OK but empty body — voice=%s", voice)
return b""
return data
async def _fallback(
self, text: str, language_code: str | None
) -> AsyncIterator[AudioChunk]:
- """Cross-Provider-Fallback Gemini-TTS → optional SAPI5.
+ """Cross-provider fallback Gemini TTS → optional SAPI5.
- Stage 1 (Gemini) bleibt aktiv: ein anderer Cloud-TTS klingt besser
- als Windows-Roboter. Stage 2 (SAPI5) ist nur aktiv wenn der User
- ``tts.allow_sapi5_fallback = true`` gesetzt hat.
+ Stage 1 (Gemini) stays active: another cloud TTS sounds better
+ than the Windows robot. Stage 2 (SAPI5) is only active when the user
+ has set ``tts.allow_sapi5_fallback = true``.
"""
log = logging.getLogger("jarvis.tts.grok-voice")
- # Stage 1: Gemini probieren (separate Quota).
+ # Stage 1: try Gemini (separate quota).
try:
from jarvis.plugins.tts.gemini_flash_tts import GeminiFlashTTS
@@ -357,21 +357,21 @@ class GrokVoiceTTS:
return
except Exception as exc: # noqa: BLE001
log.error(
- "Gemini-Fallback nach Grok-Fehler ebenfalls gescheitert (%s).",
+ "Gemini fallback after the Grok error also failed (%s).",
exc.__class__.__name__, exc_info=True,
)
if not self._allow_sapi5_fallback:
log.error(
- "Sowohl Grok als auch Gemini-TTS lieferten kein Audio. "
- "SAPI5-Notbremse per Config deaktiviert — bleibe stumm. "
- "Setze tts.allow_sapi5_fallback=true wenn Du Windows-TTS "
- "als Notausgang erlaubst.",
+ "Neither Grok nor Gemini TTS returned any audio. "
+ "SAPI5 emergency brake disabled via config — staying silent. "
+ "Set tts.allow_sapi5_fallback=true if you want Windows TTS "
+ "as an emergency exit.",
)
return
- # Stage 2: SAPI5 (Windows native, Quota-frei) — nur bei Opt-in.
- log.warning("SAPI5-Notbremse aktiv (Config-Opt-in).")
+ # Stage 2: SAPI5 (Windows native, no quota) — opt-in only.
+ log.warning("SAPI5 emergency brake active (config opt-in).")
pcm = await asyncio.to_thread(
_sapi5_synthesize, text, language_code or "de-DE"
)
@@ -390,19 +390,19 @@ class GrokVoiceTTS:
class _GrokFatalError(RuntimeError):
- """Auth/Quota-Fehler — triggert Cooldown + Fallback-Switch."""
+ """Auth/quota error — triggers a cooldown + fallback switch."""
def _split_sentences(text: str) -> list[str]:
- """Heuristischer Satz-Splitter (DE+EN). Identisch zu GeminiFlashTTS."""
+ """Heuristic sentence splitter (DE+EN). Identical to GeminiFlashTTS."""
parts = _SENTENCE_END.split(text)
return [p.strip() for p in parts if p.strip()]
-# xAI-Sprachen laut Doku: auto, en, ar-EG, ar-SA, ar-AE, bn, zh, fr, de,
+# xAI languages per the docs: auto, en, ar-EG, ar-SA, ar-AE, bn, zh, fr, de,
# hi, id, it, ja, ko, pt-BR, pt-PT, ru, es-MX, es-ES, tr, vi.
-# Sprachen mit Sub-Tag werden 1:1 durchgereicht; alles andere auf den
-# Primary-Tag verkuerzt (`de-DE` → `de`).
+# Languages with a sub-tag are passed through 1:1; everything else is
+# shortened to the primary tag (`de-DE` → `de`).
_LANGS_WITH_SUBTAG = frozenset({
"ar-eg", "ar-sa", "ar-ae", "pt-br", "pt-pt", "es-mx", "es-es",
})
diff --git a/jarvis/plugins/wake/openwakeword_provider.py b/jarvis/plugins/wake/openwakeword_provider.py
index 915e2027b6..82ae630372 100644
--- a/jarvis/plugins/wake/openwakeword_provider.py
+++ b/jarvis/plugins/wake/openwakeword_provider.py
@@ -1,14 +1,14 @@
-"""openWakeWord-Plugin — detektiert "Hey Jarvis" / "Jarvis" im Audio-Stream.
+"""openWakeWord plugin — detects "Hey Jarvis" / "Jarvis" in the audio stream.
-openWakeWord ist ein freies, Open-Source Wake-Word-System (MIT), nutzt
-ONNX-Runtime und hat "hey_jarvis" als vortrainiertes Model eingebaut —
-Null API-Key nötig.
+openWakeWord is a free, open-source wake-word system (MIT), uses
+ONNX Runtime, and has "hey_jarvis" built in as a pretrained model —
+zero API key needed.
-Input-Format: 16 kHz mono int16 PCM, Frame-Größe muss 1280 Samples (80 ms)
-sein. Wir pufern Mic-Chunks rein und splitten auf Frame-Grenze.
+Input format: 16 kHz mono int16 PCM, frame size must be 1280 samples (80 ms).
+We buffer mic chunks in and split on the frame boundary.
-Output: Continuous Score [0, 1] pro Keyword — wir filtern auf
-`activation_threshold` und debouncen (kein Re-Trigger innerhalb Cooldown).
+Output: continuous score [0, 1] per keyword — we filter on
+`activation_threshold` and debounce (no re-trigger within the cooldown).
"""
from __future__ import annotations
@@ -26,7 +26,7 @@ log = logging.getLogger("jarvis.wake")
OWW_SAMPLE_RATE = 16_000
-OWW_FRAME_SAMPLES = 1280 # openWakeWord erwartet genau diese Frame-Länge
+OWW_FRAME_SAMPLES = 1280 # openWakeWord expects exactly this frame length
# After the pipeline's STT prefix-verifier REJECTS a candidate, the detector
# stays deaf only this long (not the full cooldown). Short enough that a real
@@ -146,15 +146,15 @@ class WakeGainNormalizer:
class OpenWakeWordProvider:
- """Wake-Word-Detector — strukturell `WakeWordProvider`-kompatibel.
+ """Wake-word detector — structurally compatible with `WakeWordProvider`.
- Standardmäßig lauscht er auf "hey_jarvis" — das vortrainierte Modell
- reagiert aus meinem Test heraus sowohl auf "Hey Jarvis" als auch auf
- "Jarvis" allein, wenn der Threshold niedrig genug ist (0.5 tauglich).
+ By default it listens for "hey_jarvis" — from my testing, the pretrained
+ model responds to both "Hey Jarvis" and to "Jarvis" alone, when the
+ threshold is low enough (0.5 works).
"""
name = "openwakeword"
- supported_keywords = ("hey_jarvis",) # openWakeWord built-in Model
+ supported_keywords = ("hey_jarvis",) # openWakeWord built-in model
def __init__(
self,
@@ -169,9 +169,9 @@ class OpenWakeWordProvider:
activation_threshold: float = PRODUCTION_WAKE_THRESHOLD,
cooldown_s: float = 2.0,
inference_framework: str = "onnx",
- # Diagnose-Log: alles >= diesem Wert loggen. 0.05 ist bewusst niedrig,
- # damit beim Testen Scores überhaupt sichtbar sind (sonst silent wenn
- # User zu leise spricht oder Model deutsche Aussprache nicht gut trifft).
+ # Diagnostic log: log everything >= this value. 0.05 is deliberately low,
+ # so scores are visible at all while testing (otherwise silent when the
+ # user speaks too quietly or the model doesn't match German pronunciation well).
score_log_threshold: float = 0.05,
# Explicit ONNX wake-model path. When set (custom-wake-word feature: a
# pretrained alexa/mycroft/rhasspy from the openWakeWord package, or a
@@ -320,14 +320,14 @@ class OpenWakeWordProvider:
def _ensure_model(self) -> None:
if self._model is None:
from openwakeword.model import Model
- # wakeword_models=[...] akzeptiert entweder Built-in-Namen oder
- # Pfade zu .onnx / .tflite Dateien. Wir bevorzugen die gebündelten
- # lokalen ONNX-Pfade (siehe _model_kwargs) — kein Runtime-Download,
- # offline-fähig beim ersten Start.
+ # wakeword_models=[...] accepts either built-in names or
+ # paths to .onnx / .tflite files. We prefer the bundled
+ # local ONNX paths (see _model_kwargs) — no runtime download,
+ # offline-capable on first start.
self._model = Model(**self._model_kwargs())
async def start(self) -> None:
- """Pre-load Model — spart Latenz beim ersten Audio-Frame."""
+ """Pre-load the model — saves latency on the first audio frame."""
await asyncio.to_thread(self._ensure_model)
async def stop(self) -> None:
@@ -362,10 +362,10 @@ class OpenWakeWordProvider:
async def detect(
self, chunks: AsyncIterator[AudioChunk]
) -> AsyncIterator[str]:
- """Konsumiert Audio-Chunks, yielded Keyword-Namen bei Detection.
+ """Consumes audio chunks, yielding keyword names on detection.
- Das ist die Convenience-API — intern nutzen wir `stream()` für
- rohe Confidence-Werte (Protocol-Anforderung).
+ This is the convenience API — internally we use `stream()` for
+ raw confidence values (protocol requirement).
"""
self._ensure_model()
assert self._model is not None
@@ -383,11 +383,11 @@ class OpenWakeWordProvider:
self._reset_session_stats()
async for chunk in chunks:
- # Int16-View auf die Bytes — openWakeWord erwartet int16 arrays
+ # Int16 view onto the bytes — openWakeWord expects int16 arrays
int16 = np.frombuffer(chunk.pcm, dtype=np.int16)
buf = np.concatenate([self._residual, int16])
- # In 1280-Sample-Frames splitten, Rest aufheben
+ # Split into 1280-sample frames, keep the remainder
n_full = len(buf) // OWW_FRAME_SAMPLES
if n_full == 0:
self._residual = buf
@@ -400,7 +400,7 @@ class OpenWakeWordProvider:
# so a normal-volume "Hey Jarvis" reaches the score band the
# threshold expects (no shouting). Amplify-only + noise-floor gated.
norm_frame = self._gain.process(frame) if self._gain is not None else frame
- # predict() gibt dict zurück: {"hey_jarvis": score_float, ...}
+ # predict() returns a dict: {"hey_jarvis": score_float, ...}
scores = await asyncio.to_thread(self._model.predict, norm_frame)
self._frames_seen += 1
frame_max = max(scores.values()) if scores else 0.0
@@ -408,8 +408,8 @@ class OpenWakeWordProvider:
if frame_max > self._max_score:
self._max_score = frame_max
for keyword, score in scores.items():
- # Live-Debugging: alles über `score_log_threshold` loggen,
- # damit der User beim Testen sieht wie nah er am Hit dran ist.
+ # Live debugging: log everything over `score_log_threshold`,
+ # so the user can see during testing how close they are to a hit.
if score >= self._score_log_threshold:
log.info("wake score %s = %.3f (threshold %.2f)",
keyword, score, self._threshold)
@@ -441,9 +441,9 @@ class OpenWakeWordProvider:
self._maybe_log_stats_heartbeat()
async def stream(self) -> AsyncIterator[float]:
- """Protocol-Pflicht: Confidence-Stream. Nicht die primäre API hier."""
- # Placeholder — wir nutzen `detect()` intern. Für Protocol-Konformität
- # müsste der Consumer sein eigenes Audio einspeisen.
+ """Protocol requirement: confidence stream. Not the primary API here."""
+ # Placeholder — we use `detect()` internally. For protocol conformance
+ # the consumer would need to feed in its own audio.
if False:
yield 0.0
return