@qvac/tts-ggml 0.12.0 → 0.14.0

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.
Files changed (80) hide show
  1. package/README.md +127 -6
  2. package/docs/pocket-tts.md +12 -10
  3. package/examples/moss-sfx-fit.js +14 -7
  4. package/index.d.ts +43 -1130
  5. package/index.js +127 -3042
  6. package/lib/addonEvents.d.ts +26 -0
  7. package/lib/addonEvents.js +51 -0
  8. package/lib/conditioning.d.ts +50 -0
  9. package/lib/conditioning.js +184 -0
  10. package/lib/engineDetection.d.ts +14 -0
  11. package/lib/engineDetection.js +110 -0
  12. package/lib/engineIds.d.ts +15 -0
  13. package/lib/engineIds.js +39 -0
  14. package/lib/engineParams.d.ts +3 -0
  15. package/lib/engineParams.js +34 -0
  16. package/lib/engineSetup.d.ts +153 -0
  17. package/lib/engineSetup.js +2 -0
  18. package/lib/engines/audio8.d.ts +83 -0
  19. package/lib/engines/audio8.js +262 -0
  20. package/lib/engines/chatterbox.d.ts +10 -0
  21. package/lib/engines/chatterbox.js +112 -0
  22. package/lib/engines/cosyvoice.d.ts +87 -0
  23. package/lib/engines/cosyvoice.js +267 -0
  24. package/lib/engines/moss.d.ts +26 -0
  25. package/lib/engines/moss.js +177 -0
  26. package/lib/engines/mossSoundEffect.d.ts +41 -0
  27. package/lib/engines/mossSoundEffect.js +117 -0
  28. package/lib/engines/mossSpeech.d.ts +86 -0
  29. package/lib/engines/mossSpeech.js +228 -0
  30. package/lib/engines/parler.d.ts +71 -0
  31. package/lib/engines/parler.js +287 -0
  32. package/lib/engines/supertonic.d.ts +11 -0
  33. package/lib/engines/supertonic.js +115 -0
  34. package/lib/exclusiveQueue.d.ts +16 -0
  35. package/lib/exclusiveQueue.js +45 -0
  36. package/lib/fit.d.ts +3 -3
  37. package/lib/fit.js +4 -4
  38. package/lib/jobFields.d.ts +20 -0
  39. package/lib/jobFields.js +73 -0
  40. package/lib/modelFiles.d.ts +207 -0
  41. package/lib/modelFiles.js +117 -0
  42. package/lib/nativeParams.d.ts +12 -0
  43. package/lib/nativeParams.js +73 -0
  44. package/lib/optionValidation.d.ts +2 -0
  45. package/lib/optionValidation.js +103 -0
  46. package/lib/options.d.ts +4 -0
  47. package/lib/options.js +17 -0
  48. package/lib/pocketLifecycle.d.ts +67 -0
  49. package/lib/pocketLifecycle.js +170 -0
  50. package/lib/reload.d.ts +12 -0
  51. package/lib/reload.js +76 -0
  52. package/lib/sentenceStream.d.ts +85 -0
  53. package/lib/sentenceStream.js +367 -0
  54. package/lib/setup.d.ts +7 -0
  55. package/lib/setup.js +169 -0
  56. package/lib/streamingSupport.d.ts +8 -0
  57. package/lib/streamingSupport.js +77 -0
  58. package/lib/types.d.ts +465 -0
  59. package/lib/types.js +2 -0
  60. package/lib/voiceControls.d.ts +12 -0
  61. package/lib/voiceControls.js +23 -0
  62. package/package.json +17 -11
  63. package/test/integration/audio8.test.js +6 -12
  64. package/test/integration/fit.test.js +115 -18
  65. package/test/integration/gpu-smoke.test.js +2 -11
  66. package/test/integration/lavasr-enhancer.test.js +2 -15
  67. package/test/integration/moss-fit.test.js +13 -13
  68. package/test/integration/moss-sfx-fit.test.js +14 -14
  69. package/test/integration/moss-sfx.test.js +29 -4
  70. package/test/integration/moss-speech.test.js +19 -5
  71. package/test/integration/moss.test.js +93 -56
  72. package/test/mobile/integration.auto.cjs +10 -0
  73. package/test/mobile/test-groups.json +6 -2
  74. package/test/utils/desktopGpuBackend.js +21 -0
  75. package/test/utils/gpuOnly.js +15 -0
  76. package/test/utils/mossBackend.js +34 -0
  77. package/test/utils/mossGpuValidation.js +70 -0
  78. package/test/utils/perf-helper.js +275 -0
  79. package/test/utils/runTTS.js +1 -1
  80. package/test/utils/testThreads.js +5 -0
package/README.md CHANGED
@@ -17,6 +17,22 @@ LavaSR neural denoise + 48 kHz bandwidth-extension enhancement. Unsure
17
17
  which checkpoint to stage? Start with [Choosing a model](#choosing-a-model).
18
18
 
19
19
 
20
+ ### CosyVoice3 Core ML sidecars
21
+
22
+ Apple builds support optional CosyVoice3 Core ML sidecars through the native
23
+ `speech-cpp` 2026-10-19 dependency. Export and placement details are in the
24
+ [CosyVoice3 Core ML guide](https://github.com/tetherto/qvac-fabric-speech.cpp/blob/ea128498e23d20cd122729275e92361b11a361df/engines/tts/docs/cosyvoice3.md#core-ml-sidecars).
25
+ Re-export existing CosyVoice3 LM sidecars with the updated exporter to include
26
+ the cache feedback correction for consecutive predictions.
27
+
28
+ The LM, flow frontend/decoder, F0 predictor and HiFT vocoder use resident
29
+ sidecars when present and fall back to ggml when unavailable. HiFT exports
30
+ use FP32 for waveform parity. Core ML chooses operation placement, so a
31
+ sidecar does not guarantee ANE execution or a speed improvement.
32
+ When a sidecar is present, `assessFit` returns an error with reason
33
+ `coreml-memory-estimate-unavailable`; its memory usage is not projected.
34
+
35
+
20
36
  Runs in-process with a persistent native engine — the GGUFs, the S3Gen
21
37
  preload, the ggml backend, and any voice-conditioning tensors are
22
38
  loaded once and reused across every synthesis call. GPU acceleration
@@ -29,7 +45,8 @@ Xclipse/Mali → Vulkan). Parler supports Apple/Metal, linux CUDA, and the
29
45
  validated Android paths, including Vulkan on ARM Mali (see
30
46
  [Backends & GPU acceleration](#backends--gpu-acceleration)). Audio8 supports
31
47
  CUDA/Vulkan offload on Linux and Vulkan on Windows. MOSS GPU offload is
32
- validated on Apple/Metal.
48
+ validated on Apple/Metal; desktop CUDA/Vulkan validation requires the native
49
+ and registry prerequisites described under [MOSS](#moss).
33
50
 
34
51
  [qvac-tts-cpp]: https://github.com/tetherto/qvac-fabric-speech.cpp/tree/master/engines/tts
35
52
 
@@ -674,6 +691,8 @@ Notes:
674
691
  engine runs its ggml graph on the GPU (falling back to the ggml CPU backend
675
692
  when no GPU backend initialises), a CPU engine keeps the scalar core.
676
693
  `denoiserBackendDevice` / `denoiserBackendId` in the stats report where it ran.
694
+ - Android ARM Mali devices can use Vulkan for denoising with `config.useGPU: true`.
695
+ This path is validated on Pixel 9 Pro XL (Mali-G715).
677
696
  - The tts-cpp UL-UNAS forward is implemented in
678
697
  [qvac-fabric-speech.cpp#78](https://github.com/tetherto/qvac-fabric-speech.cpp/pull/78)
679
698
  (scalar CPU port, validated bit-close to the ONNX reference); it requires a
@@ -1060,6 +1079,100 @@ falls back to CPU and sets `response.stats.gpuUnsupported`. `backendsDir`
1060
1079
  reaches MOSS like every other engine, so builds that load ggml backends at
1061
1080
  runtime find them.
1062
1081
 
1082
+ The same controls apply to MOSS-TTSD and MOSS-Speech. `nGpuLayers` is a
1083
+ boolean GPU request for these engines (zero = CPU, non-zero = GPU), not a
1084
+ partial layer count. The addon forwards these controls to the native engine;
1085
+ it does not choose a different backend or change the CPU default.
1086
+ `response.stats.backendId` identifies the language-model backend (2 = CUDA,
1087
+ 3 = Vulkan); it is not a measurement of every codec operation.
1088
+
1089
+ The combined desktop CUDA/Vulkan speech changes in
1090
+ [Vulkan #308](https://github.com/tetherto/qvac-fabric-speech.cpp/pull/308),
1091
+ including [CUDA #321](https://github.com/tetherto/qvac-fabric-speech.cpp/pull/321),
1092
+ merged to native master at `84b02694001cfea863167776dbc185474a816656`.
1093
+ The exact native dependency versions are declared in [vcpkg.json](vcpkg.json),
1094
+ and the registry configuration is declared in
1095
+ [vcpkg-configuration.json](vcpkg-configuration.json). The earlier native `f4d4c257`
1096
+ passed ten smaller-model CUDA/Vulkan cases; those results do not establish GPU
1097
+ validation of the final native revision or the packaged addon. Rebuild the addon
1098
+ before running its GPU tests. Native desktop results also do not establish
1099
+ Android support or speech-quality signoff.
1100
+
1101
+ Packaged-addon CUDA/Vulkan inference still requires validation on provisioned
1102
+ GPU hosts before claiming a validated release.
1103
+
1104
+ From `packages/tts-ggml`, resolve the checked-in manifest without building or
1105
+ downloading models (with `VCPKG_ROOT` set):
1106
+
1107
+ ```sh
1108
+ vcpkg install --dry-run --triplet x64-linux --x-feature=cuda --x-feature=vulkan
1109
+ ```
1110
+
1111
+ On a macOS host without a Linux cross-compiler, prefix that dry-run command
1112
+ with `VCPKG_FEATURE_FLAGS=-compilertracking` to check registry resolution only.
1113
+ For a bounded native build on a suitably provisioned Linux GPU host:
1114
+
1115
+ ```sh
1116
+ CMAKE_BUILD_PARALLEL_LEVEL=2 VCPKG_MAX_CONCURRENCY=2 npm run build:cuda
1117
+ ```
1118
+
1119
+ The normal PR workflow requires approval of the `fork-ci` environment for
1120
+ external forks. Obtain that approval through the existing gate; a manual
1121
+ workflow dispatch is not a substitute for fork approval.
1122
+
1123
+ On a desktop with those prerequisites, stage the TTS and TTSD backbones,
1124
+ codec decoder/encoder and the bundled `test/reference-audio/jfk.wav`, plus
1125
+ the Speech model/codec. Set
1126
+ `QVAC_TEST_MOSS_MODEL_DIR` and `QVAC_TEST_MOSS_SPEECH_MODEL_DIR` to their
1127
+ respective directories. Run each available backend in a fresh process:
1128
+
1129
+ ```sh
1130
+ QVAC_TEST_MOSS_FULL_GPU=true TTS_CPP_GPU_BACKEND=cuda npx --no-install brittle-bare test/integration/moss.test.js test/integration/moss-speech.test.js
1131
+ QVAC_TEST_MOSS_FULL_GPU=true TTS_CPP_GPU_BACKEND=vulkan npx --no-install brittle-bare test/integration/moss.test.js test/integration/moss-speech.test.js
1132
+ ```
1133
+
1134
+ The tests check the exact pinned backend, `backendDevice` and
1135
+ `gpuUnsupported` for TTS batch/streaming/cloning, TTSD dialogue, and Speech
1136
+ text/audio replies. CPU control cases still require CPU even with a GPU pin.
1137
+ `QVAC_TEST_MOSS_FULL_GPU=true` fails before model loading unless both model
1138
+ directories, the TTS/TTSD/Speech backbones, all three codec GGUFs, and the
1139
+ reference WAV exist. It also requires an explicit backend pin (case-insensitive),
1140
+ rejects `NO_GPU=true` and mobile CPU-only cases, and checks that every required
1141
+ case completes. Run both files together without test filters: a successful full
1142
+ run has 12 passing tests, including the two completion checks, and no skips.
1143
+ Preflight only checks asset presence; actual model loading and inference must
1144
+ also pass. These commands cover TTS, TTSD and Speech, not MOSS-SoundEffect (SFX).
1145
+ To validate the fresh packaged addons on the provisioned Linux GPU runner,
1146
+ dispatch the existing integration workflow on the branch being tested:
1147
+
1148
+ ```sh
1149
+ gh workflow run integration-test-nx.yml --repo tetherto/qvac --ref <branch> -f moss_packaged_gpu=true
1150
+ ```
1151
+
1152
+ This opt-in mode retains the `release` environment gate and builds both addons
1153
+ from the dispatch SHA with build concurrency capped at two. It stages the fresh
1154
+ platform packages through `link:platform`, verifies that both CUDA and Vulkan
1155
+ plugins are present, then runs CUDA and Vulkan sequentially. Each backend must
1156
+ pass the 12 TTS/TTSD/Speech tests above, two SFX tests (including exact backend
1157
+ and no-fallback assertions for both GPU clips), and the focused ASR Spanish
1158
+ transcription test with default and hotword prompts. Fixture skips fail the run.
1159
+ CPU control cases remain part of the TTS/SFX suites.
1160
+
1161
+ The runner stages q8_0 TTS/TTSD/Speech/SFX backbones and q5_0 Transcribe, with
1162
+ the required codec precision preserved. TTS/TTSD q8_0 are generated on the
1163
+ runner from the source checkpoints using the pinned native quantizer. The
1164
+ artifacts retain source pins, model and prebuild hashes, the fresh prebuilds,
1165
+ and per-backend logs/results; model weights are removed and never uploaded.
1166
+ This mode does not publish. A dispatched or building run is not GPU validation:
1167
+ only passing case logs from both backends establish packaged-addon coverage.
1168
+
1169
+ Without strict mode, developer behavior is unchanged: an unpinned run accepts
1170
+ the normal GPU cascade, missing model directories skip tests, and missing
1171
+ encoder/TTSD assets omit cloning/dialogue cases. Such runs are not full GPU
1172
+ validation. `npm run test:node` covers backend selection and strict validation
1173
+ failures without loading models. Do not load these multi-GB models on
1174
+ memory-constrained hosts.
1175
+
1063
1176
  ## MOSS-SoundEffect
1064
1177
 
1065
1178
  MOSS-SoundEffect-v2 generates a sound effect from a text description: a Qwen3
@@ -1348,12 +1461,14 @@ const {
1348
1461
 
1349
1462
  `assessFit` projects a load against the memory free right now. It reads GGUF metadata and never weight data, so the registry's weightless copy of each file answers the same as the file itself and the projection can run before anything is downloaded. It is a module export, not an instance method: nothing is loaded to call it.
1350
1463
 
1464
+ `assessFit` returns a Promise. Fits run one at a time within this addon.
1465
+
1351
1466
  A request is a `createInstance` config plus the workload, so it carries the same keys the load takes and the engine's own config builder reads it.
1352
1467
 
1353
1468
  ```js
1354
1469
  const TTSGgml = require('@qvac/tts-ggml')
1355
1470
 
1356
- const fit = TTSGgml.assessFit({
1471
+ const fit = await TTSGgml.assessFit({
1357
1472
  engineType: 'supertonic',
1358
1473
  supertonicModelPath: '/models/supertonic.gguf',
1359
1474
  useGPU: true,
@@ -1393,7 +1508,7 @@ Everything else comes from the load config: `nGpuLayers` and `useGPU` carry the
1393
1508
 
1394
1509
  `deviceSharesHostMemory` reports that the device pool is system RAM, so host bytes compete with device bytes.
1395
1510
 
1396
- A model the engine cannot read is `status: "error"`, as is a voice with no fitter, which reports `reason: "unsupported-engine"`. MOSS-TTS, MOSS-TTSD and MOSS-SoundEffect are supported. MOSS-Speech has no SDK fit projection. A broken request, or a host with no native binding, throws.
1511
+ A model the engine cannot read resolves to `status: "error"`, as does a voice with no fitter, which reports `reason: "unsupported-engine"`. MOSS-TTS, MOSS-TTSD and MOSS-SoundEffect are supported. MOSS-Speech has no SDK fit projection. A broken request, or a host with no native binding, rejects.
1397
1512
 
1398
1513
  MOSS-TTS and MOSS-TTSD share the `moss` fitter. `promptRows` is the complete
1399
1514
  native prompt length, including special tokens, encoded speaker references and
@@ -1404,7 +1519,7 @@ The fitter does not open reference recordings. Use the TTSD backbone to assess
1404
1519
  dialogue, supplying its complete prompt and total reference workload.
1405
1520
 
1406
1521
  ```js
1407
- const fit = TTSGgml.assessFit({
1522
+ const fit = await TTSGgml.assessFit({
1408
1523
  engineType: 'moss',
1409
1524
  mossBackbonePath: './moss-tts-delay-f16.gguf',
1410
1525
  mossCodecDecoderPath: './moss-codec-decoder-f16.gguf',
@@ -1426,7 +1541,7 @@ The supertonic fitter covers the fused graph path: a validated GPU, or a CPU wit
1426
1541
  ### MOSS-SoundEffect fit
1427
1542
 
1428
1543
  ```js
1429
- const fit = TTSGgml.assessFit({
1544
+ const fit = await TTSGgml.assessFit({
1430
1545
  engineType: 'moss-sfx',
1431
1546
  mossSoundEffectPath: './moss-sfx-v2-q8_0.gguf',
1432
1547
  prompt: 'Rain falling on a tin roof.',
@@ -1581,7 +1696,8 @@ build becomes loadable once `npm run link:platform` (run by
1581
1696
 
1582
1697
  The vcpkg port is hosted in
1583
1698
  [`tetherto/qvac-registry-vcpkg`][registry] and pulls
1584
- [`qvac-tts.cpp`][qvac-tts-cpp] at a pinned REF. See
1699
+ [`qvac-fabric-speech.cpp`](https://github.com/tetherto/qvac-fabric-speech.cpp)
1700
+ (`engines/tts`) at a pinned REF. See
1585
1701
  [`vcpkg-configuration.json`](./vcpkg-configuration.json) for the
1586
1702
  baseline commit.
1587
1703
 
@@ -1640,4 +1756,9 @@ Apache-2.0. See [LICENSE](./LICENSE).
1640
1756
 
1641
1757
  ## Pocket TTS
1642
1758
 
1759
+ The native `speech-cpp` dependency includes Pocket Metal, CUDA, Vulkan and
1760
+ OpenCL support in the native library. The JavaScript Pocket API continues
1761
+ to require `config.useGPU: false`; updating the native dependency does not
1762
+ remove that addon validation.
1763
+
1643
1764
  See [Pocket TTS](docs/pocket-tts.md) for model conversion, addon/SDK usage, supported controls and validation commands.
@@ -1,7 +1,9 @@
1
1
  # Pocket TTS
2
2
 
3
- Pocket is an English, CPU-only TTS engine implemented in the Fabric speech
4
- library. It streams PCM16 audio through the `@qvac/tts-ggml` addon. Python
3
+ Pocket is an English TTS engine implemented in the Fabric speech library.
4
+ The native library supports CPU, Metal, CUDA, Vulkan and OpenCL; the
5
+ `@qvac/tts-ggml` JavaScript API currently accepts CPU inference only.
6
+ It streams PCM16 audio through the addon. Python
5
7
  is used only to convert weights and benchmark the upstream reference; it is
6
8
  not needed for native synthesis. Inference plugin and public SDK integration
7
9
  will follow in a separate change after the addon release.
@@ -139,22 +141,22 @@ audio and broad subjective quality evaluations remain outside this coverage.
139
141
 
140
142
  ## Native dependencies and measured performance
141
143
 
142
- The manifest requires speech-cpp and ggml-speech `2026-09-15` without changing
143
- `vcpkg-configuration.json`. These registered versions select the merged source
144
- commits `a976c4d63195601fcff8bfc0c2cdf3ef36fba539` (speech-cpp) and
145
- `59a0ca2c2bcd7de36c27d930f79e0c94cc0c2ff3` (ggml-speech).
146
- [Registry #367](https://github.com/tetherto/qvac-registry-vcpkg/pull/367)
147
- contains these packages. Pocket resolves CPU memory planning through the
144
+ The exact native dependency versions are declared in [vcpkg.json](../vcpkg.json).
145
+ The Pocket GPU implementation comes from the merged
146
+ [Fabric #338](https://github.com/tetherto/qvac-fabric-speech.cpp/pull/338)
147
+ change, registered in
148
+ [registry #433](https://github.com/tetherto/qvac-registry-vcpkg/pull/433).
149
+ Pocket resolves CPU memory planning through the
148
150
  backend registry, fixing the Linux/Android unresolved `ggml_graph_plan` import.
149
151
  The native fixes are merged in [ggml #92](https://github.com/tetherto/qvac-ext-ggml/pull/92)
150
152
  and [speech #251](https://github.com/tetherto/qvac-fabric-speech.cpp/pull/251).
151
153
 
152
- Before the addon-only review revision, these exact native port trees passed
154
+ Before the addon-only review revision, the original CPU-only native dependency versions passed
153
155
  [the full prebuild and integration run](https://github.com/tetherto/qvac/actions/runs/34975293366)
154
156
  at Fabric `49d864d2e1a2070a4cb9872cd0f62319fdb9e839`: nine platform prebuilds
155
157
  and seven desktop integration lanes covering CPU, Metal, Vulkan and CUDA.
156
158
  That run validates the native dependencies; it does not validate subsequent
157
- JavaScript review changes. The same native pins also passed all 10 Pocket
159
+ JavaScript review changes. Those original native pins also passed all 10 Pocket
158
160
  CTests with upstream numerical fixtures, static/dynamic CPU planner tests,
159
161
  and 116 selected Supertonic Metal operations against CPU. Six paired
160
162
  old-versus-merged native audio cases produced bit-identical PCM; this is
@@ -8,11 +8,18 @@ if (!model || !prompt || seconds === undefined) {
8
8
  throw new Error('Usage: bare examples/moss-sfx-fit.js <model.gguf> <prompt> <seconds>')
9
9
  }
10
10
 
11
- const fit = TTSGgml.assessFit({
12
- engineType: 'moss-sfx',
13
- mossSoundEffectPath: model,
14
- prompt,
15
- seconds: Number(seconds),
16
- useGPU: false
11
+ async function main() {
12
+ const fit = await TTSGgml.assessFit({
13
+ engineType: 'moss-sfx',
14
+ mossSoundEffectPath: model,
15
+ prompt,
16
+ seconds: Number(seconds),
17
+ useGPU: false
18
+ })
19
+ console.log(fit.report || `${fit.status}: ${fit.reason}`)
20
+ }
21
+
22
+ main().catch((err) => {
23
+ console.error(err)
24
+ process.exit(1)
17
25
  })
18
- console.log(fit.report || `${fit.status}: ${fit.reason}`)