stackvox 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
stackvox/__init__.py ADDED
@@ -0,0 +1,16 @@
1
+ """stackvox — offline TTS using Kokoro-82M."""
2
+
3
+ from importlib.metadata import PackageNotFoundError
4
+ from importlib.metadata import version as _pkg_version
5
+
6
+ from stackvox import daemon
7
+ from stackvox.engine import Stackvox, speak, synthesize
8
+
9
+ try:
10
+ __version__ = _pkg_version("stackvox")
11
+ except PackageNotFoundError:
12
+ # Running from a source tree without the package installed (e.g. editable
13
+ # bootstrap before `pip install -e .` has completed).
14
+ __version__ = "0.0.0+unknown"
15
+
16
+ __all__ = ["Stackvox", "daemon", "speak", "synthesize"]
stackvox/__main__.py ADDED
@@ -0,0 +1,10 @@
1
+ """Entry point for `python -m stackvox`."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+
7
+ from stackvox.cli import main
8
+
9
+ if __name__ == "__main__":
10
+ sys.exit(main())
stackvox/cli.py ADDED
@@ -0,0 +1,179 @@
1
+ """CLI: `stackvox <subcommand>` or `stackvox "text"` (defaults to speak)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import logging
7
+ import sys
8
+ from pathlib import Path
9
+
10
+ import soundfile as sf
11
+
12
+ from stackvox import daemon
13
+ from stackvox.engine import DEFAULT_LANG, DEFAULT_SPEED, DEFAULT_VOICE, Stackvox
14
+
15
+
16
+ def _configure_logging() -> None:
17
+ logging.basicConfig(
18
+ level=logging.INFO,
19
+ format="[stackvox] %(message)s",
20
+ stream=sys.stderr,
21
+ )
22
+
23
+
24
+ SUBCOMMANDS = {"serve", "stop", "status", "say", "speak", "voices", "welcome"}
25
+
26
+ WELCOME_LINES = [
27
+ ("bf_emma", "en-gb", "Welcome to stackvox."),
28
+ ("af_heart", "en-us", "Welcome to stackvox."),
29
+ ("ff_siwis", "fr-fr", "Bienvenue sur stackvox."),
30
+ ("hf_alpha", "hi", "Stackvox mein aapka swagat hai."),
31
+ ("if_sara", "it", "Benvenuti a stackvox."),
32
+ ("pf_dora", "pt-br", "Bem-vindo ao stackvox."),
33
+ ]
34
+
35
+
36
+ def _build_parser() -> argparse.ArgumentParser:
37
+ parser = argparse.ArgumentParser(prog="stackvox", description="Kokoro-82M TTS")
38
+ sub = parser.add_subparsers(dest="cmd")
39
+
40
+ p_speak = sub.add_parser("speak", help="Synthesize and play in-process (loads model each run)")
41
+ _add_voice_args(p_speak)
42
+ p_speak.add_argument("text", nargs="?")
43
+ p_speak.add_argument("--file", type=Path)
44
+ p_speak.add_argument("--out", type=Path, help="Write wav instead of playing")
45
+
46
+ p_say = sub.add_parser("say", help="Send text to daemon (fast; fails if daemon not running)")
47
+ _add_voice_args(p_say)
48
+ p_say.add_argument("text", nargs="?")
49
+ p_say.add_argument("--file", type=Path)
50
+ p_say.add_argument(
51
+ "--fallback-say", action="store_true", help="Shell out to macOS `say` if daemon unreachable"
52
+ )
53
+
54
+ p_serve = sub.add_parser("serve", help="Run the daemon in the foreground")
55
+ _add_voice_args(p_serve)
56
+
57
+ sub.add_parser("stop", help="Stop the running daemon")
58
+ sub.add_parser("status", help="Print daemon status")
59
+ sub.add_parser("voices", help="List available voices")
60
+ sub.add_parser("welcome", help="Play a multilingual welcome message")
61
+
62
+ return parser
63
+
64
+
65
+ def _add_voice_args(parser: argparse.ArgumentParser) -> None:
66
+ parser.add_argument("--voice", default=DEFAULT_VOICE)
67
+ parser.add_argument("--speed", type=float, default=DEFAULT_SPEED)
68
+ parser.add_argument("--lang", default=DEFAULT_LANG)
69
+
70
+
71
+ def _read_text(args: argparse.Namespace) -> str | None:
72
+ file: Path | None = getattr(args, "file", None)
73
+ if file is not None:
74
+ return file.read_text(encoding="utf-8")
75
+ text: str | None = getattr(args, "text", None)
76
+ return text
77
+
78
+
79
+ def _cmd_speak(args: argparse.Namespace) -> int:
80
+ text = _read_text(args)
81
+ if not text or not text.strip():
82
+ print("Error: provide text or --file", file=sys.stderr)
83
+ return 1
84
+ tts = Stackvox(voice=args.voice, speed=args.speed, lang=args.lang)
85
+ if args.out:
86
+ samples, sr = tts.synthesize(text)
87
+ sf.write(args.out, samples, sr)
88
+ print(f"Wrote {args.out}", file=sys.stderr)
89
+ else:
90
+ tts.speak(text)
91
+ return 0
92
+
93
+
94
+ def _cmd_say(args: argparse.Namespace) -> int:
95
+ text = _read_text(args)
96
+ if not text or not text.strip():
97
+ print("Error: provide text or --file", file=sys.stderr)
98
+ return 1
99
+ ok, resp = daemon.say(text, voice=args.voice, speed=args.speed, lang=args.lang)
100
+ if ok:
101
+ return 0
102
+ if args.fallback_say:
103
+ import shutil
104
+ import subprocess
105
+
106
+ if shutil.which("say"):
107
+ subprocess.run(["say", text], check=False)
108
+ return 0
109
+ print(f"[stackvox] {resp}", file=sys.stderr)
110
+ return 2
111
+
112
+
113
+ def _cmd_serve(args: argparse.Namespace) -> int:
114
+ try:
115
+ daemon.serve(voice=args.voice, speed=args.speed, lang=args.lang)
116
+ except RuntimeError as exc:
117
+ print(f"[stackvox] {exc}", file=sys.stderr)
118
+ return 1
119
+ return 0
120
+
121
+
122
+ def _cmd_stop(_: argparse.Namespace) -> int:
123
+ if not daemon.is_running():
124
+ print("[stackvox] daemon not running", file=sys.stderr)
125
+ return 0
126
+ ok, resp = daemon.stop()
127
+ print(resp, file=sys.stderr)
128
+ return 0 if ok else 1
129
+
130
+
131
+ def _cmd_status(_: argparse.Namespace) -> int:
132
+ if daemon.is_running():
133
+ print(f"running (pid {daemon.PID_PATH.read_text().strip()}) on {daemon.SOCKET_PATH}")
134
+ return 0
135
+ print("stopped")
136
+ return 1
137
+
138
+
139
+ def _cmd_voices(args: argparse.Namespace) -> int:
140
+ tts = Stackvox()
141
+ for name in tts.voices():
142
+ print(name)
143
+ return 0
144
+
145
+
146
+ def _cmd_welcome(_: argparse.Namespace) -> int:
147
+ tts = Stackvox()
148
+ tts.speak_sequence([{"text": text, "voice": voice, "lang": lang} for voice, lang, text in WELCOME_LINES])
149
+ return 0
150
+
151
+
152
+ def main() -> int:
153
+ _configure_logging()
154
+ argv = sys.argv[1:]
155
+ # Back-compat: `stackvox "text"` with no subcommand → speak.
156
+ if argv and argv[0] not in SUBCOMMANDS and not argv[0].startswith("-"):
157
+ argv = ["speak", *argv]
158
+
159
+ parser = _build_parser()
160
+ args = parser.parse_args(argv)
161
+
162
+ if not args.cmd:
163
+ parser.print_help()
164
+ return 1
165
+
166
+ handlers = {
167
+ "speak": _cmd_speak,
168
+ "say": _cmd_say,
169
+ "serve": _cmd_serve,
170
+ "stop": _cmd_stop,
171
+ "status": _cmd_status,
172
+ "voices": _cmd_voices,
173
+ "welcome": _cmd_welcome,
174
+ }
175
+ return handlers[args.cmd](args)
176
+
177
+
178
+ if __name__ == "__main__":
179
+ sys.exit(main())
stackvox/daemon.py ADDED
@@ -0,0 +1,214 @@
1
+ """Long-running daemon that preloads Kokoro and plays speech on request.
2
+
3
+ Avoids the ~1-2s model load on every invocation. Listens on a unix socket.
4
+ Protocol: one JSON object per connection (line-terminated), reply is a status line.
5
+
6
+ Request shapes:
7
+ {"text": "...", "voice": "af_sarah", "speed": 1.0, "lang": "en-us"}
8
+ {"command": "stop"}
9
+ {"command": "ping"}
10
+
11
+ Replies: "ok", "busy", "err: <msg>".
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import logging
18
+ import os
19
+ import queue
20
+ import signal
21
+ import socket
22
+ import socketserver
23
+ import threading
24
+
25
+ import sounddevice as sd
26
+
27
+ from stackvox.engine import DEFAULT_LANG, DEFAULT_SPEED, DEFAULT_VOICE, Stackvox
28
+ from stackvox.paths import pid_path, socket_path
29
+
30
+ logger = logging.getLogger(__name__)
31
+
32
+ SOCKET_PATH = socket_path()
33
+ PID_PATH = pid_path()
34
+ MAX_QUEUE = 2
35
+ WORKER_POLL_SECONDS = 0.5
36
+ CLIENT_TIMEOUT_SECONDS = 1.0
37
+ PING_TIMEOUT_SECONDS = 0.5
38
+ RECV_BYTES = 1024
39
+
40
+
41
+ def _refresh_audio_devices() -> None:
42
+ """Reset PortAudio so the next play picks up the current system default.
43
+
44
+ PortAudio caches the default output device at init time; without this the
45
+ daemon keeps playing to whatever was default when it started (e.g. the
46
+ built-in speakers after the user swapped to Bluetooth). Terminating and
47
+ re-initialising is the only portable way to refresh that cache. Costs
48
+ ~10-50ms per call, which is invisible next to synthesis time.
49
+ """
50
+ try:
51
+ sd._terminate()
52
+ sd._initialize()
53
+ except Exception:
54
+ logger.exception("failed to refresh audio devices")
55
+
56
+
57
+ class _DaemonState:
58
+ def __init__(self, voice: str, speed: float, lang: str) -> None:
59
+ self.tts = Stackvox(voice=voice, speed=speed, lang=lang)
60
+ self.queue: queue.Queue[dict] = queue.Queue(maxsize=MAX_QUEUE)
61
+ self.stop_event = threading.Event()
62
+ self.worker = threading.Thread(target=self._worker, daemon=True)
63
+ self.worker.start()
64
+
65
+ def _worker(self) -> None:
66
+ while not self.stop_event.is_set():
67
+ try:
68
+ req = self.queue.get(timeout=WORKER_POLL_SECONDS)
69
+ except queue.Empty:
70
+ continue
71
+ _refresh_audio_devices()
72
+ try:
73
+ self.tts.speak(
74
+ req["text"],
75
+ voice=req.get("voice"),
76
+ speed=req.get("speed"),
77
+ lang=req.get("lang"),
78
+ )
79
+ except Exception:
80
+ logger.exception("playback error")
81
+
82
+ def submit(self, req: dict) -> bool:
83
+ try:
84
+ self.queue.put_nowait(req)
85
+ return True
86
+ except queue.Full:
87
+ return False
88
+
89
+ def shutdown(self) -> None:
90
+ self.stop_event.set()
91
+
92
+
93
+ class _Handler(socketserver.StreamRequestHandler):
94
+ def handle(self) -> None:
95
+ line = self.rfile.readline().decode("utf-8", errors="replace").strip()
96
+ if not line:
97
+ return
98
+
99
+ try:
100
+ req = json.loads(line)
101
+ except json.JSONDecodeError:
102
+ req = {"text": line}
103
+
104
+ state: _DaemonState = self.server.state # type: ignore[attr-defined]
105
+ command = req.get("command")
106
+
107
+ if command == "ping":
108
+ self.wfile.write(b"ok\n")
109
+ return
110
+
111
+ if command == "stop":
112
+ self.wfile.write(b"ok\n")
113
+ threading.Thread(target=self.server.shutdown, daemon=True).start()
114
+ return
115
+
116
+ text = req.get("text")
117
+ if not text:
118
+ self.wfile.write(b"err: missing text\n")
119
+ return
120
+
121
+ if state.submit(req):
122
+ self.wfile.write(b"ok\n")
123
+ else:
124
+ self.wfile.write(b"busy\n")
125
+
126
+
127
+ class _UnixServer(socketserver.ThreadingMixIn, socketserver.UnixStreamServer):
128
+ allow_reuse_address = True
129
+ daemon_threads = True
130
+
131
+
132
+ def _pid_alive(pid: int) -> bool:
133
+ try:
134
+ os.kill(pid, 0)
135
+ return True
136
+ except OSError:
137
+ return False
138
+
139
+
140
+ def is_running() -> bool:
141
+ if not PID_PATH.exists():
142
+ return False
143
+ try:
144
+ pid = int(PID_PATH.read_text().strip())
145
+ except ValueError:
146
+ return False
147
+ return _pid_alive(pid)
148
+
149
+
150
+ def serve(voice: str = DEFAULT_VOICE, speed: float = DEFAULT_SPEED, lang: str = DEFAULT_LANG) -> None:
151
+ if is_running():
152
+ raise RuntimeError(f"daemon already running (pid {PID_PATH.read_text().strip()})")
153
+
154
+ SOCKET_PATH.parent.mkdir(parents=True, exist_ok=True)
155
+ if SOCKET_PATH.exists():
156
+ SOCKET_PATH.unlink()
157
+
158
+ state = _DaemonState(voice=voice, speed=speed, lang=lang)
159
+ server = _UnixServer(str(SOCKET_PATH), _Handler)
160
+ server.state = state # type: ignore[attr-defined]
161
+
162
+ PID_PATH.write_text(str(os.getpid()))
163
+
164
+ def handle_signal(signum: int, frame: object) -> None:
165
+ state.shutdown()
166
+ threading.Thread(target=server.shutdown, daemon=True).start()
167
+
168
+ signal.signal(signal.SIGTERM, handle_signal)
169
+ signal.signal(signal.SIGINT, handle_signal)
170
+
171
+ logger.info("daemon listening on %s (pid %d)", SOCKET_PATH, os.getpid())
172
+ try:
173
+ server.serve_forever()
174
+ finally:
175
+ SOCKET_PATH.unlink(missing_ok=True)
176
+ PID_PATH.unlink(missing_ok=True)
177
+
178
+
179
+ def send(req: dict, timeout: float = CLIENT_TIMEOUT_SECONDS) -> tuple[bool, str]:
180
+ """Send a request to the daemon. Returns (ok, response)."""
181
+ if not SOCKET_PATH.exists():
182
+ return False, "daemon not running"
183
+ sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
184
+ sock.settimeout(timeout)
185
+ try:
186
+ sock.connect(str(SOCKET_PATH))
187
+ sock.sendall((json.dumps(req) + "\n").encode("utf-8"))
188
+ resp = sock.recv(RECV_BYTES).decode("utf-8", errors="replace").strip()
189
+ return resp == "ok", resp
190
+ except (TimeoutError, ConnectionRefusedError, FileNotFoundError, OSError) as exc:
191
+ return False, f"{type(exc).__name__}: {exc}"
192
+ finally:
193
+ sock.close()
194
+
195
+
196
+ def say(
197
+ text: str, voice: str | None = None, speed: float | None = None, lang: str | None = None
198
+ ) -> tuple[bool, str]:
199
+ req: dict = {"text": text}
200
+ if voice is not None:
201
+ req["voice"] = voice
202
+ if speed is not None:
203
+ req["speed"] = speed
204
+ if lang is not None:
205
+ req["lang"] = lang
206
+ return send(req)
207
+
208
+
209
+ def stop() -> tuple[bool, str]:
210
+ return send({"command": "stop"})
211
+
212
+
213
+ def ping() -> tuple[bool, str]:
214
+ return send({"command": "ping"}, timeout=PING_TIMEOUT_SECONDS)
stackvox/engine.py ADDED
@@ -0,0 +1,164 @@
1
+ """Core engine: model loading, synthesis, and playback."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import logging
6
+ import urllib.request
7
+ from pathlib import Path
8
+
9
+ import numpy as np
10
+ import sounddevice as sd
11
+ from kokoro_onnx import Kokoro
12
+
13
+ from stackvox.paths import cache_dir as _default_cache_dir
14
+
15
+ logger = logging.getLogger(__name__)
16
+
17
+ DEFAULT_VOICE = "af_sarah"
18
+ DEFAULT_SPEED = 1.0
19
+ DEFAULT_LANG = "en-us"
20
+
21
+ _MODEL_URL = "https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/kokoro-v1.0.onnx"
22
+ _VOICES_URL = "https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/voices-v1.0.bin"
23
+
24
+
25
+ def _ensure_models(cache_dir: Path) -> tuple[Path, Path]:
26
+ cache_dir.mkdir(parents=True, exist_ok=True)
27
+ model_path = cache_dir / "kokoro-v1.0.onnx"
28
+ voices_path = cache_dir / "voices-v1.0.bin"
29
+ for path, url in [(model_path, _MODEL_URL), (voices_path, _VOICES_URL)]:
30
+ if path.exists():
31
+ continue
32
+ logger.info("downloading %s...", path.name)
33
+ urllib.request.urlretrieve(url, path)
34
+ return model_path, voices_path
35
+
36
+
37
+ class Stackvox:
38
+ """Reusable TTS engine. Load the model once, speak many times.
39
+
40
+ Example:
41
+ tts = Stackvox(voice="af_bella")
42
+ tts.speak("Hello world")
43
+ """
44
+
45
+ def __init__(
46
+ self,
47
+ voice: str = DEFAULT_VOICE,
48
+ speed: float = DEFAULT_SPEED,
49
+ lang: str = DEFAULT_LANG,
50
+ cache_dir: Path | None = None,
51
+ ) -> None:
52
+ self.voice = voice
53
+ self.speed = speed
54
+ self.lang = lang
55
+ model_path, voices_path = _ensure_models(cache_dir or _default_cache_dir())
56
+ self._kokoro = Kokoro(str(model_path), str(voices_path))
57
+
58
+ def synthesize(
59
+ self,
60
+ text: str,
61
+ voice: str | None = None,
62
+ speed: float | None = None,
63
+ lang: str | None = None,
64
+ ) -> tuple[np.ndarray, int]:
65
+ """Return (samples, sample_rate) without playing."""
66
+ samples, sample_rate = self._kokoro.create(
67
+ text,
68
+ voice=voice or self.voice,
69
+ speed=speed if speed is not None else self.speed,
70
+ lang=lang or self.lang,
71
+ )
72
+ return samples, sample_rate
73
+
74
+ def speak(
75
+ self,
76
+ text: str,
77
+ voice: str | None = None,
78
+ speed: float | None = None,
79
+ lang: str | None = None,
80
+ blocking: bool = True,
81
+ ) -> None:
82
+ """Synthesize and play through the system default output device."""
83
+ samples, sample_rate = self.synthesize(text, voice=voice, speed=speed, lang=lang)
84
+ sd.play(samples, sample_rate)
85
+ if blocking:
86
+ sd.wait()
87
+
88
+ def stop(self) -> None:
89
+ """Stop any in-progress playback started with blocking=False."""
90
+ sd.stop()
91
+
92
+ def voices(self) -> list[str]:
93
+ return sorted(self._kokoro.get_voices())
94
+
95
+ def speak_sequence(
96
+ self,
97
+ lines: list[dict],
98
+ gap_seconds: float = 0.0,
99
+ concurrent: bool = True,
100
+ ) -> None:
101
+ """Synthesize multiple lines, concatenate, play as one gapless buffer.
102
+
103
+ Each line is a dict: {"text": str, "voice": str?, "speed": float?, "lang": str?}.
104
+ With concurrent=True, synthesis happens in parallel threads (ONNX runtime
105
+ releases the GIL) so the upfront wait is closer to the longest single
106
+ synthesis rather than the sum of all of them.
107
+ """
108
+ if not lines:
109
+ return
110
+
111
+ def synth(line: dict) -> tuple[np.ndarray, int]:
112
+ kwargs = {k: v for k, v in line.items() if k != "text"}
113
+ return self.synthesize(line["text"], **kwargs)
114
+
115
+ if concurrent and len(lines) > 1:
116
+ from concurrent.futures import ThreadPoolExecutor
117
+
118
+ with ThreadPoolExecutor(max_workers=len(lines)) as pool:
119
+ results = list(pool.map(synth, lines))
120
+ else:
121
+ results = [synth(line) for line in lines]
122
+
123
+ sample_rate = results[0][1]
124
+ segments: list[np.ndarray] = []
125
+ gap = np.zeros(int(sample_rate * gap_seconds), dtype=results[0][0].dtype) if gap_seconds > 0 else None
126
+ for idx, (samples, _) in enumerate(results):
127
+ segments.append(samples)
128
+ if gap is not None and idx < len(results) - 1:
129
+ segments.append(gap)
130
+
131
+ audio = np.concatenate(segments)
132
+ sd.play(audio, sample_rate)
133
+ sd.wait()
134
+
135
+
136
+ _default: Stackvox | None = None
137
+
138
+
139
+ def _get_default() -> Stackvox:
140
+ global _default
141
+ if _default is None:
142
+ _default = Stackvox()
143
+ return _default
144
+
145
+
146
+ def speak(
147
+ text: str,
148
+ voice: str = DEFAULT_VOICE,
149
+ speed: float = DEFAULT_SPEED,
150
+ lang: str = DEFAULT_LANG,
151
+ blocking: bool = True,
152
+ ) -> None:
153
+ """One-shot: synthesize and play. Reuses a module-level engine across calls."""
154
+ _get_default().speak(text, voice=voice, speed=speed, lang=lang, blocking=blocking)
155
+
156
+
157
+ def synthesize(
158
+ text: str,
159
+ voice: str = DEFAULT_VOICE,
160
+ speed: float = DEFAULT_SPEED,
161
+ lang: str = DEFAULT_LANG,
162
+ ) -> tuple[np.ndarray, int]:
163
+ """One-shot synthesis. Returns (samples, sample_rate)."""
164
+ return _get_default().synthesize(text, voice=voice, speed=speed, lang=lang)
stackvox/paths.py ADDED
@@ -0,0 +1,36 @@
1
+ """Filesystem paths used across stackvox: model cache, daemon socket, pid file.
2
+
3
+ Centralising these avoids leaking private helpers between modules and keeps
4
+ the `STACKVOX_CACHE_DIR` / `STACKVOX_SOCKET` override rules in one place.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import os
10
+ from pathlib import Path
11
+
12
+
13
+ def cache_dir() -> Path:
14
+ """Directory holding the model, voice pack, socket, and pid file.
15
+
16
+ Honours `STACKVOX_CACHE_DIR`; defaults to `~/.cache/stackvox`.
17
+ """
18
+ override = os.environ.get("STACKVOX_CACHE_DIR")
19
+ if override:
20
+ return Path(override).expanduser()
21
+ return Path.home() / ".cache" / "stackvox"
22
+
23
+
24
+ def socket_path() -> Path:
25
+ """Unix socket the daemon listens on. Lives under `cache_dir()`.
26
+
27
+ Note: the bash `stackvox-say` helper honours `STACKVOX_SOCKET` so users
28
+ can point it at a socket on a different machine / mount — the Python
29
+ daemon does not, since it owns the socket and derives it from its own
30
+ cache dir.
31
+ """
32
+ return cache_dir() / "daemon.sock"
33
+
34
+
35
+ def pid_path() -> Path:
36
+ return cache_dir() / "daemon.pid"
stackvox/py.typed ADDED
File without changes
@@ -0,0 +1,67 @@
1
+ #!/bin/bash
2
+ # stackvox-say — fast TTS client for hooks.
3
+ # Talks directly to the stackvox daemon over its unix socket, bypassing
4
+ # Python startup. Falls back to macOS `say` with --fallback-say.
5
+ #
6
+ # Usage:
7
+ # stackvox-say "text"
8
+ # stackvox-say --voice bf_emma --speed 1.1 "text"
9
+ # stackvox-say --fallback-say "text"
10
+ # stackvox-say --socket /tmp/other.sock "text"
11
+ #
12
+ # Env:
13
+ # STACKVOX_SOCKET — override socket path (default: ~/.cache/stackvox/daemon.sock)
14
+
15
+ set -u
16
+
17
+ sock="${STACKVOX_SOCKET:-$HOME/.cache/stackvox/daemon.sock}"
18
+ voice="" speed="" lang="" fallback=0 text=""
19
+
20
+ while [[ $# -gt 0 ]]; do
21
+ case "$1" in
22
+ --voice) voice="$2"; shift 2 ;;
23
+ --speed) speed="$2"; shift 2 ;;
24
+ --lang) lang="$2"; shift 2 ;;
25
+ --fallback-say) fallback=1; shift ;;
26
+ --socket) sock="$2"; shift 2 ;;
27
+ -h|--help)
28
+ sed -n '3,13p' "$0" | sed 's/^# \{0,1\}//'
29
+ exit 0 ;;
30
+ --) shift; text="$*"; break ;;
31
+ -*) echo "stackvox-say: unknown flag: $1" >&2; exit 1 ;;
32
+ *) text="${text:+$text }$1"; shift ;;
33
+ esac
34
+ done
35
+
36
+ if [[ -z "$text" ]]; then
37
+ echo "stackvox-say: no text provided" >&2
38
+ exit 1
39
+ fi
40
+
41
+ do_fallback() {
42
+ if [[ $fallback -eq 1 ]] && command -v say >/dev/null; then
43
+ say "$text"
44
+ exit 0
45
+ fi
46
+ exit 2
47
+ }
48
+
49
+ [[ -S "$sock" ]] || do_fallback
50
+ command -v nc >/dev/null || do_fallback
51
+
52
+ # Minimal JSON escape: backslash, double quote, newline, tab.
53
+ esc=${text//\\/\\\\}
54
+ esc=${esc//\"/\\\"}
55
+ esc=${esc//$'\n'/\\n}
56
+ esc=${esc//$'\t'/\\t}
57
+
58
+ payload='{"text":"'$esc'"'
59
+ [[ -n "$voice" ]] && payload+=',"voice":"'$voice'"'
60
+ [[ -n "$speed" ]] && payload+=',"speed":'$speed
61
+ [[ -n "$lang" ]] && payload+=',"lang":"'$lang'"'
62
+ payload+='}'
63
+
64
+ resp=$(printf '%s\n' "$payload" | nc -U -w 1 "$sock" 2>/dev/null)
65
+ [[ "$resp" == "ok" ]] && exit 0
66
+
67
+ do_fallback
@@ -0,0 +1,185 @@
1
+ Metadata-Version: 2.4
2
+ Name: stackvox
3
+ Version: 0.2.0
4
+ Summary: Offline TTS library using Kokoro-82M
5
+ Author-email: "StackOne Technologies Ltd." <engineering@stackone.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/StackOneHQ/stackvox
8
+ Project-URL: Repository, https://github.com/StackOneHQ/stackvox
9
+ Project-URL: Issues, https://github.com/StackOneHQ/stackvox/issues
10
+ Keywords: tts,kokoro,onnx,offline,speech
11
+ Classifier: Operating System :: MacOS
12
+ Classifier: Operating System :: POSIX :: Linux
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ License-File: NOTICE
20
+ Requires-Dist: kokoro-onnx>=0.4.0
21
+ Requires-Dist: soundfile>=0.12.1
22
+ Requires-Dist: sounddevice>=0.4.6
23
+ Requires-Dist: numpy>=1.24
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=8.0; extra == "dev"
26
+ Requires-Dist: pytest-mock>=3.12; extra == "dev"
27
+ Requires-Dist: pytest-cov>=5.0; extra == "dev"
28
+ Requires-Dist: ruff>=0.5; extra == "dev"
29
+ Requires-Dist: pre-commit>=3.7; extra == "dev"
30
+ Requires-Dist: commitizen>=3.27; extra == "dev"
31
+ Requires-Dist: mypy>=1.11; extra == "dev"
32
+ Dynamic: license-file
33
+
34
+ # stackvox
35
+
36
+ [![ci](https://github.com/StackOneHQ/stackvox/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/StackOneHQ/stackvox/actions/workflows/ci.yml)
37
+ [![coverage](https://codecov.io/gh/StackOneHQ/stackvox/branch/main/graph/badge.svg)](https://codecov.io/gh/StackOneHQ/stackvox)
38
+ [![python](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/downloads/)
39
+ [![license](https://img.shields.io/badge/license-Apache%202.0-blue)](./LICENSE)
40
+
41
+ Offline TTS using [Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) via [kokoro-onnx](https://github.com/thewh1teagle/kokoro-onnx). Apache 2.0 model, ~340MB, CPU real-time, plays straight to system audio. Designed to be importable as a Python library, drivable as a CLI, or poked via a unix socket for ~13ms speech requests from shell scripts.
42
+
43
+ ## Install
44
+
45
+ Recommended — install globally with pipx so `stackvox` and `stackvox-say` end up on PATH:
46
+
47
+ ```bash
48
+ pipx install git+https://github.com/StackOneHQ/stackvox.git
49
+ ```
50
+
51
+ Upgrade later with `pipx install --force git+https://github.com/StackOneHQ/stackvox.git` (pipx's `upgrade` doesn't always detect new commits on git installs).
52
+
53
+ Dev install from a clone:
54
+
55
+ ```bash
56
+ python3 -m venv .venv && source .venv/bin/activate
57
+ pip install -e .
58
+ ```
59
+
60
+ Model + voice files auto-download to `~/.cache/stackvox/` on first use. Override with `STACKVOX_CACHE_DIR`.
61
+
62
+ ## CLI
63
+
64
+ ```bash
65
+ stackvox "Hello world" # synthesize and play in-process
66
+ stackvox speak "Hi" --voice bf_emma # same, explicit subcommand
67
+ stackvox speak "save" --out a.wav # write wav instead of playing
68
+ stackvox welcome # multilingual welcome (6 languages)
69
+ stackvox voices # list all voice ids
70
+ ```
71
+
72
+ Daemon mode (keeps the model resident so each subsequent call is instant):
73
+
74
+ ```bash
75
+ stackvox serve # foreground; run with `nohup stackvox serve &` to background
76
+ stackvox status # is the daemon up?
77
+ stackvox say "Hello" # send text to the daemon (fails if not running)
78
+ stackvox stop # graceful shutdown
79
+ ```
80
+
81
+ ## `stackvox-say` (bash helper, ~13ms)
82
+
83
+ When you want minimum latency from shell scripts (hooks, CI steps, etc.), skip the Python client and use the bash helper — it talks directly to the daemon's unix socket via `nc`:
84
+
85
+ ```bash
86
+ stackvox-say "back to you in 5"
87
+ stackvox-say --voice bf_emma --speed 1.1 "hello"
88
+ stackvox-say --fallback-say "text" # shell out to macOS `say` if daemon is down
89
+ ```
90
+
91
+ Exit codes: `0` ok, `2` daemon unreachable (unless `--fallback-say` was given).
92
+
93
+ ## Python library
94
+
95
+ ```python
96
+ from stackvox import Stackvox, speak, synthesize
97
+
98
+ # One-shot — model loads on first call, reused for subsequent calls.
99
+ speak("Hello world")
100
+
101
+ # Reusable engine.
102
+ tts = Stackvox(voice="af_bella")
103
+ tts.speak("First line")
104
+ tts.speak("Faster", speed=1.2)
105
+
106
+ # Non-blocking playback.
107
+ tts.speak("async", blocking=False)
108
+ tts.stop()
109
+
110
+ # Raw samples for custom processing.
111
+ samples, sr = tts.synthesize("give me the array")
112
+
113
+ # Gapless multi-line playback with concurrent synthesis.
114
+ tts.speak_sequence([
115
+ {"text": "Hello", "voice": "af_heart", "lang": "en-us"},
116
+ {"text": "Bonjour", "voice": "ff_siwis", "lang": "fr-fr"},
117
+ ])
118
+ ```
119
+
120
+ ### Daemon client from Python
121
+
122
+ ```python
123
+ from stackvox import daemon
124
+
125
+ ok, resp = daemon.say("queue this via the running daemon")
126
+ if daemon.is_running():
127
+ daemon.stop()
128
+ ```
129
+
130
+ ## Voices
131
+
132
+ Kokoro ships voices across several languages. Voice prefix encodes gender + language:
133
+
134
+ | Prefix | Language | Example |
135
+ | -------------- | ---------------- | ------------------------ |
136
+ | `af_*`, `am_*` | American English | `af_heart`, `am_michael` |
137
+ | `bf_*`, `bm_*` | British English | `bf_emma`, `bm_fable` |
138
+ | `ff_*` | French | `ff_siwis` |
139
+ | `hf_*`, `hm_*` | Hindi | `hf_alpha`, `hm_omega` |
140
+ | `if_*`, `im_*` | Italian | `if_sara`, `im_nicola` |
141
+ | `pf_*`, `pm_*` | Portuguese | `pf_dora`, `pm_alex` |
142
+ | `ef_*`, `em_*` | Spanish | `ef_dora`, `em_alex` |
143
+ | `jf_*`, `jm_*` | Japanese | `jf_alpha` |
144
+ | `zf_*`, `zm_*` | Mandarin Chinese | `zf_xiaoxiao` |
145
+
146
+ Run `stackvox voices` for the authoritative list.
147
+
148
+ ## Architecture
149
+
150
+ ```
151
+ ┌────────────────────┐ unix socket ┌─────────────────────────┐
152
+ │ stackvox-say │ ───────────────────────▶ │ stackvox daemon │
153
+ │ (bash, ~13ms) │ JSON line per request │ (Python, long-lived) │
154
+ └────────────────────┘ │ │
155
+ ┌────────────────────┐ ~500ms (Py startup) │ preloaded Kokoro ONNX │
156
+ │ stackvox say │ ───────────────────────▶ │ worker thread playback │
157
+ │ (Python client) │ │ → sounddevice → audio │
158
+ └────────────────────┘ └─────────────────────────┘
159
+ ┌────────────────────┐
160
+ │ stackvox speak │ loads model in-process, plays, exits
161
+ │ (one-shot CLI) │
162
+ └────────────────────┘
163
+ ```
164
+
165
+ Socket lives at `~/.cache/stackvox/daemon.sock` (override with `STACKVOX_SOCKET` for the client, `STACKVOX_CACHE_DIR` for the daemon). Protocol is one line of JSON per connection: `{"text":"...", "voice":"...", "speed":1.0, "lang":"en-us"}`; reply is `ok` / `busy` / `err: <msg>`. Plain text (no JSON) is accepted as a fallback and treated as `{"text": line}`.
166
+
167
+ Queue depth is 2 — rapid-fire requests beyond that get `busy` rather than piling up.
168
+
169
+ Before each utterance the daemon resets PortAudio so it picks up the current system default output device. Swap from speakers to Bluetooth headphones mid-session and the next `say` follows you — no daemon restart needed. The refresh costs ~10–50ms per play, which is invisible next to synthesis time.
170
+
171
+ ## Requirements
172
+
173
+ - Python 3.10+
174
+ - macOS or Linux
175
+ - `nc` (BSD netcat — default on macOS, `netcat-openbsd` on Linux) for the bash helper
176
+
177
+ ## License & attributions
178
+
179
+ stackvox itself is licensed under the **Apache License, Version 2.0** — see [`LICENSE`](./LICENSE). Third-party attributions are collected in [`NOTICE`](./NOTICE); the summary below is informational.
180
+
181
+ **Model.** Speech is generated by [Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) (© hexgrad, Apache 2.0). The ONNX-converted weights (`kokoro-v1.0.onnx`) and voice pack (`voices-v1.0.bin`) are downloaded from the [kokoro-onnx](https://github.com/thewh1teagle/kokoro-onnx) release assets on first use and cached under `~/.cache/stackvox/`. stackvox does not modify or redistribute them.
182
+
183
+ **Runtime dependencies.** [`kokoro-onnx`](https://github.com/thewh1teagle/kokoro-onnx) (MIT, © thewh1teagle), [`onnxruntime`](https://github.com/microsoft/onnxruntime) (MIT, © Microsoft), [`sounddevice`](https://python-sounddevice.readthedocs.io/) (MIT, © Matthias Geier), [`soundfile`](https://github.com/bastibe/python-soundfile) (BSD-3, © Bastian Bechtold), [`numpy`](https://numpy.org/) (BSD-3).
184
+
185
+ **GPL note.** `kokoro-onnx` pulls in [`phonemizer-fork`](https://github.com/bootphon/phonemizer) as a transitive runtime dependency; it is licensed under **GPL-3.0**. stackvox does not bundle, modify, or statically link it — pip installs it alongside stackvox and the two communicate through phonemizer's published Python API at runtime. If you redistribute a combined work (e.g. a frozen binary, container image, or vendored wheel set) that includes phonemizer-fork, review GPL-3.0 obligations for that distribution.
@@ -0,0 +1,15 @@
1
+ stackvox/__init__.py,sha256=eAwh2UQ13cz2eyNzYwxJ50YUnfwTcjW68KXo_Yujzfk,547
2
+ stackvox/__main__.py,sha256=YoGkms95VN4s2xp7FBahskL3qUJvkA-8ufVJsUuWBvs,172
3
+ stackvox/cli.py,sha256=Q2ersirDvx2pt9db3M0AbuR_k7UnZYLFANOscIzSVxI,5351
4
+ stackvox/daemon.py,sha256=QXkgeWSzCUJ9GeAuYp1uRsWeo94MYN2TemaTQKBS7gE,6384
5
+ stackvox/engine.py,sha256=_50Tp2wbgU2bBokX_dwve-4r_45ig2xukO0B7fZvRY4,5181
6
+ stackvox/paths.py,sha256=Kwuz3O1ThFn1Sm7UuGAPP4kn3EQdK2lB6yFCYcUcT6o,1089
7
+ stackvox/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ stackvox-0.2.0.data/scripts/stackvox-say,sha256=d9rr0tlSJ5J5k0RzuF5jSp0h-Qx7PwBOuJoG5jwX1pA,1840
9
+ stackvox-0.2.0.dist-info/licenses/LICENSE,sha256=CVx4HimvDfnRRN6rvesNgREDn71BcpjpX7tySJEzsWo,11309
10
+ stackvox-0.2.0.dist-info/licenses/NOTICE,sha256=vJdZzhJ185QPNzycwOem5NApKbVU_fPhgg3PjYTW7OA,2364
11
+ stackvox-0.2.0.dist-info/METADATA,sha256=aN7_27UjtZICP8ixdVIi957l5OgYtKSmQEKbfaihUmI,9260
12
+ stackvox-0.2.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
13
+ stackvox-0.2.0.dist-info/entry_points.txt,sha256=B0LUAKX06oBp-dnBsIqNyCHNqfvH1Wmqz_0zxBVQJiU,47
14
+ stackvox-0.2.0.dist-info/top_level.txt,sha256=rFjhxmtLVrms2NY2nHXkT-24JnLmHrRET5eF9CpFzyE,9
15
+ stackvox-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ stackvox = stackvox.cli:main
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may accept and charge a
167
+ fee for accepting support, warranty, indemnity, or other liability
168
+ obligations and/or rights consistent with this License. However, in
169
+ accepting such obligations, You may act only on Your own behalf
170
+ and on Your sole responsibility, not on behalf of any other
171
+ Contributor, and only if You agree to indemnify, defend, and hold
172
+ each Contributor harmless for any liability incurred by, or claims
173
+ asserted against, such Contributor by reason of your accepting any
174
+ such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 StackOne Technologies Ltd.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,62 @@
1
+ stackvox
2
+ Copyright 2026 StackOne Technologies Ltd.
3
+
4
+ This product includes software developed by StackOne Technologies Ltd.
5
+ (https://www.stackone.com/) and is licensed under the Apache License,
6
+ Version 2.0. A copy of the license is provided in the LICENSE file.
7
+
8
+ --------------------------------------------------------------------------------
9
+ Third-party components
10
+ --------------------------------------------------------------------------------
11
+
12
+ This product relies on, but does not bundle, the following components. They
13
+ are downloaded or installed separately at install / first-run time. Their
14
+ original copyright notices and license terms apply; see the URLs below for
15
+ the authoritative text.
16
+
17
+ Kokoro-82M (TTS model weights and voice files)
18
+ Copyright (c) hexgrad
19
+ Licensed under the Apache License, Version 2.0
20
+ https://huggingface.co/hexgrad/Kokoro-82M
21
+
22
+ stackvox downloads the ONNX-converted model (`kokoro-v1.0.onnx`) and voice
23
+ pack (`voices-v1.0.bin`) from the kokoro-onnx GitHub release assets on
24
+ first use and caches them under `~/.cache/stackvox/`. These files are
25
+ neither modified nor redistributed by stackvox.
26
+
27
+ kokoro-onnx
28
+ Copyright (c) 2025 github.com/thewh1teagle
29
+ Licensed under the MIT License
30
+ https://github.com/thewh1teagle/kokoro-onnx
31
+
32
+ onnxruntime
33
+ Copyright (c) Microsoft Corporation
34
+ Licensed under the MIT License
35
+ https://github.com/microsoft/onnxruntime
36
+
37
+ numpy
38
+ Copyright (c) 2005-2024, NumPy Developers
39
+ Licensed under the BSD 3-Clause License
40
+ https://numpy.org/
41
+
42
+ sounddevice
43
+ Copyright (c) 2015-2025 Matthias Geier
44
+ Licensed under the MIT License
45
+ https://python-sounddevice.readthedocs.io/
46
+
47
+ soundfile (pysoundfile)
48
+ Copyright (c) 2013, Bastian Bechtold
49
+ Licensed under the BSD 3-Clause License
50
+ https://github.com/bastibe/python-soundfile
51
+
52
+ phonemizer-fork
53
+ Licensed under the GNU General Public License v3.0
54
+ https://github.com/bootphon/phonemizer
55
+
56
+ phonemizer-fork is a transitive runtime dependency of kokoro-onnx. It is
57
+ installed by pip alongside stackvox but is neither modified, bundled, nor
58
+ statically linked into stackvox itself — stackvox and phonemizer-fork
59
+ communicate only through phonemizer-fork's published Python interface at
60
+ runtime. Downstream users who distribute a combined work that includes
61
+ phonemizer-fork should review GPL-3.0 obligations for their own
62
+ distribution.
@@ -0,0 +1 @@
1
+ stackvox