Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ VS_SPEECH_EXE=.engine/speech.exe VS_DRAMA_MODEL=path/to/Drama-35B-A3B-Japanese-v

## Architecture

**Engine process.** `engine::EngineSupervisor` keeps one resident `speech worker <model>` child process and talks JSON Lines over stdin/stdout (protocol 4; stdout carries only the protocol, logs go to stderr). It handles `synthesize` (streams base64 PCM `chunk`s), `add_voice`, `count_tokens`, `info` and `cancel`. Switching models stops one worker and starts the next. `speech voice`, `speech asr`, `speech models` and `speech pull` run as short-lived processes. Model catalog names (`irodori-tts-mf`, or `NAME:TYPE`) are resolved to file paths from `speech models --json` before use (D-02); a model that is not fetched is an error, never a silent download: `speech pull` runs only from the catalog dialog's download, with progress (D-59). The protocol details and measurements are in `docs/engine-protocol.md`: read it before touching `engine/` or the adapters.
**Engine process.** `engine::EngineSupervisor` keeps one resident `speech worker <model>` child process and talks JSON Lines over stdin/stdout (protocol 4; stdout carries only the protocol, logs go to stderr). It handles `synthesize` (streams base64 PCM `chunk`s), `add_voice`, `count_tokens`, `info` and `cancel`. Switching models stops one worker and starts the next. `speech voice`, `speech asr`, `speech models` and `speech pull` run as short-lived processes. Model catalog names (`irodori-tts-mf`, or `NAME:TYPE`) are resolved to file paths from `speech models --json` before use; a model that is not fetched is an error, never a silent download: `speech pull` runs only from the catalog dialog's download, with progress (D-59). The protocol details and measurements are in `docs/engine-protocol.md`: read it before touching `engine/` or the adapters.

**Model adapters** (`src-tauri/src/models/`). Each model declares `Capabilities` (tag syntax brackets/emoji, sample rate, multi-speaker support, and so on) and an `OptionSpec` schema, and turns a `LineRequest` into a worker request. The worker rejects any member it does not know (`invalid_argument`), so an adapter must send only options its model takes. The UI builds its option forms from the schema (`features/models/OptionForm.tsx`). Irodori strips `[..]` cues and `<|speaker:N|>` before sending (D-04). The tag palettes are `assets/tags/*.json`; the download catalog is `assets/models/catalog.json`.

Expand All @@ -68,9 +68,11 @@ VS_SPEECH_EXE=.engine/speech.exe VS_DRAMA_MODEL=path/to/Drama-35B-A3B-Japanese-v
- The voice library (`.voice.gguf` files) lives in the app data dir under `voices/`.
- Scratch audio lives in `work/<uuid>/` in the local app data dir, one per running instance and locked by its `.lock` (`work.rs`, D-39): untitled projects' takes, `design/` candidates and `trimmed/` references. At start, folders that no running instance holds are swept.

**Debug handles.** For E2E driven over DevTools, `window.__speechorus` exposes the stores and actions (D-19), and the window event `vs-add-refs` adds reference audio by path (D-35).
**Debug handles.** For E2E driven over DevTools, `window.__speechorus` exposes the stores and actions (D-19), and the window event `vs-add-refs` adds reference audio by path (D-19).

## Project process

- `docs/architecture.md` is the approved plan. Every departure from it is recorded in `docs/deviations.md` as a `D-NN` entry (what / why / workaround / user impact, plus a status tag). Confirm large changes that affect a requirement with the user before making them, and add a D-entry for any deviation. Commit messages refer to these IDs (e.g. "(D-37)").
- `docs/architecture.md` describes the design as it is now; update it when the structure changes. Known gaps, deferred features and planned work are GitHub Issues (`gh issue list`): check the open ones for the area before starting, close them from the PR (`Fixes #N`), and open one for a gap you find but do not fix.
- `docs/decisions/` holds the decision records (`D-NN-slug.md`, indexed in its `README.md`): workarounds for engine or library limits, approaches chosen over others (with the rejected ones and why), behavior that is on purpose although it looks wrong, and rules later work must keep. Read the records for the area before changing it, so a constraint or a rejected approach is not undone by accident. Write a new record (next free ID) only for such a decision, not for a plain feature or fix; when a decision changes, update the old record's status instead of leaving two that disagree. Code comments and commit messages cite the IDs (e.g. "(D-37)").
- Development is left to Claude. Decide technical and design matters yourself; ask the user first only before removing a feature or substantially changing how the app behaves for them, touching their data or settings outside the repository, or doing anything hard to undo or outward-facing.
- Known engine limitation: a single-request `<|speaker:N|>` scene with Drama-3-Japanese voices only speaker 0, so per-line scene mode is the default (D-01).
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ npx tauri build --no-bundle

CI (`.github/workflows/ci.yml`) runs the same checks on every pull request into `main` and every push to `main`. Run `npm run check` before you push anyway. The pre-commit hook formats and lints only the staged files (Oxlint `--fix`, Oxfmt, rustfmt); skip it with `git commit --no-verify` when you need to.

Dependencies are held to versions published at least 7 days ago, and install scripts run only for packages approved in `package.json` `allowScripts` (`.npmrc`; needs npm 11.19+). Crates in `Cargo.lock` are checked the same way by `scripts/cargo-release-age.mjs`. See D-43 in `docs/deviations.md`.
Dependencies are held to versions published at least 7 days ago, and install scripts run only for packages approved in `package.json` `allowScripts` (`.npmrc`; needs npm 11.19+). Crates in `Cargo.lock` are checked the same way by `scripts/cargo-release-age.mjs`. See [D-43](docs/decisions/D-43-supply-chain.md).

`speech.exe` is looked up in this order: the `SPEECHORUS_SPEECH` environment variable, next to the executable (`speech/speech.exe`, `speech.exe`), then `.engine/speech.exe` (for development).

Expand All @@ -76,7 +76,9 @@ VS_SPEECH_EXE=.engine/speech.exe VS_DRAMA_MODEL=path/to/Drama-35B-A3B-Japanese-v

## Documentation

- [docs/architecture.md](docs/architecture.md): design (the approved plan)
- [docs/architecture.md](docs/architecture.md): how the app is built
- [docs/decisions/](docs/decisions/README.md): decision records (why things are the way they are, and what was tried and rejected)
- [Issues](https://github.com/eddybean/speechorus/issues): known gaps, deferred features and planned work
- [docs/engine-protocol.md](docs/engine-protocol.md): speech.cpp worker protocol and measurements (memory, time, known limitations)

## License
Expand Down
Loading