# Source code for the voice engine on this site (GPL corresponding source + Apache engine)

This directory ships the complete source corresponding to the compiled voice engine files
served in ../ (the engine-*.js, chunk-*.js, worker-*.js and espeak-ng-ar-*.js files).

## What is here

1. espeak-ng-1.52.0.tar.gz
   Full source of eSpeak NG at tag 1.52.0 (commit 4870adfa25b1a32b4361592f1be8a40337c58d6c),
   GNU GPL v3 or later. This is the source that was compiled to WebAssembly into the
   espeak-ng-ar-*.js file served in ../. License text: ../COPYING-espeak-ng-GPL-3.0.txt.
   Upstream project: https://github.com/espeak-ng/espeak-ng

2. nabra-tts-16b5281.tar.gz
   Source of the nabra-tts engine (Apache-2.0) at the exact pinned commit
   16b5281ce61993df3526740990cf845a3f3036f4 that this site's compiled voice files are built
   from (tsup production build of src/, plus espeak/build.sh and espeak/wrapper.c and the
   espeak-ng-data files used for Arabic/English phonemes).
   Upstream project: https://github.com/Oddadmix/nabra-tts

## How the shipped espeak-ng-ar-*.js was built (reproducible inputs)

See ../BUILD-INPUTS-espeak-ng-ar.txt for the full record:
- eSpeak NG source: this archive (tag 1.52.0)
- Phoneme data: espeakng_loader Python wheel v0.2.4 (espeak-ng-data 1.52.0)
- Build script + C wrapper: espeak/build.sh and espeak/wrapper.c inside the nabra-tts
  archive above (also shipped loose as ../build.sh and ../wrapper.c, unmodified)
- Toolchain: emsdk release 9146b21a8350e85c9934cf570f7a6ceb7470623b (Emscripten 7.0.1);
  exact cmake/emcc flags are in build.sh
- Build steps: install emsdk at that release, activate Emscripten 7.0.1, unpack this
  espeak-ng source, then run build.sh from the nabra-tts espeak/ directory.

## How the shipped engine/chunk/worker files were built

From the nabra-tts archive: npm ci && npx tsup (see package.json / tsup.config.ts in the
archive). Output dist/ files are the engine-*.js / chunk-*.js / worker-*.js files served
here (names carry a content hash).

3. host-worker.js
   This site's own glue that loads and runs the combined engine inside a dedicated Web Worker and
   exposes only a string-in/audio-out message protocol. Provided here so the running combination
   (engine + loader glue) can be inspected and rebuilt exactly as served.

## Architecture note (GPL separation)

The compiled voice engine runs inside a dedicated Web Worker (../host-worker.js, this
site's own MIT-licensed glue). The page communicates with the engine only through a
documented message protocol: {id, op:"load"|"diacritize"|"generate", text} in, and
progress events plus {audio:ArrayBuffer, sr} out. No shared memory, no shared
internal data structures, no function calls across the boundary.
The engine (nabra-tts + eSpeak NG) is treated as one combined GPL-covered program; its
complete source is these two archives. The site's own application code is a separate
program and is not published here.
