@tryhamster/gerbil 1.2.2 → 1.3.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.
- package/README.md +6 -6
- package/dist/architectures-Ol7yUmKf.mjs.map +1 -1
- package/dist/browser/index.d.ts +68 -2
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/cli.mjs +7 -7
- package/dist/cli.mjs.map +1 -1
- package/dist/defaults-CudhglS1.mjs +47 -0
- package/dist/defaults-CudhglS1.mjs.map +1 -0
- package/dist/frameworks/express.d.mts +2 -1
- package/dist/frameworks/express.d.mts.map +1 -1
- package/dist/frameworks/express.mjs +1 -1
- package/dist/frameworks/fastify.d.mts +2 -1
- package/dist/frameworks/fastify.d.mts.map +1 -1
- package/dist/frameworks/fastify.mjs +1 -1
- package/dist/frameworks/hono.d.mts +2 -1
- package/dist/frameworks/hono.d.mts.map +1 -1
- package/dist/frameworks/hono.mjs +1 -1
- package/dist/frameworks/next.d.mts +4 -3
- package/dist/frameworks/next.d.mts.map +1 -1
- package/dist/frameworks/next.mjs +1 -1
- package/dist/frameworks/react.d.mts +2 -1
- package/dist/frameworks/react.d.mts.map +1 -1
- package/dist/frameworks/trpc.d.mts +2 -1
- package/dist/frameworks/trpc.d.mts.map +1 -1
- package/dist/frameworks/trpc.mjs +1 -1
- package/dist/{gerbil-DkilSf1Q.d.mts → gerbil-4Xid85_Z.d.mts} +31 -6
- package/dist/gerbil-4Xid85_Z.d.mts.map +1 -0
- package/dist/gerbil-BikD0xFU.mjs +4 -0
- package/dist/{gerbil-BMZ5wnM_.mjs → gerbil-Du-1M2Wq.mjs} +52 -14
- package/dist/gerbil-Du-1M2Wq.mjs.map +1 -0
- package/dist/gpu/hooks.d.mts +25 -2
- package/dist/gpu/hooks.d.mts.map +1 -1
- package/dist/gpu/hooks.mjs +98 -1
- package/dist/gpu/hooks.mjs.map +1 -1
- package/dist/gpu/index.d.mts +3 -2
- package/dist/gpu/index.mjs +4 -4
- package/dist/{gpu-BZHJDas1.mjs → gpu-BECDib8p.mjs} +2085 -217
- package/dist/gpu-BECDib8p.mjs.map +1 -0
- package/dist/{index-HVS7yeLx.d.mts → index-C4kJrqs1.d.mts} +99 -5
- package/dist/index-C4kJrqs1.d.mts.map +1 -0
- package/dist/{index-Dgmb2kE3.d.mts → index-CRDf-nS4.d.mts} +2 -2
- package/dist/{index-Dgmb2kE3.d.mts.map → index-CRDf-nS4.d.mts.map} +1 -1
- package/dist/index.d.mts +6 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/integrations/ai-sdk.d.mts +2 -1
- package/dist/integrations/ai-sdk.d.mts.map +1 -1
- package/dist/integrations/ai-sdk.mjs +1 -1
- package/dist/integrations/langchain.d.mts +2 -1
- package/dist/integrations/langchain.d.mts.map +1 -1
- package/dist/integrations/langchain.mjs +1 -1
- package/dist/integrations/llamaindex.d.mts +2 -1
- package/dist/integrations/llamaindex.d.mts.map +1 -1
- package/dist/integrations/llamaindex.mjs +1 -1
- package/dist/integrations/mcp.d.mts +4 -3
- package/dist/integrations/mcp.d.mts.map +1 -1
- package/dist/integrations/mcp.mjs +4 -4
- package/dist/{mcp-D1laYce-.mjs → mcp-4imtBQLX.mjs} +3 -3
- package/dist/{mcp-D1laYce-.mjs.map → mcp-4imtBQLX.mjs.map} +1 -1
- package/dist/memory/index.d.mts +2 -2
- package/dist/{moonshine-stt-Bj1zJfZg.mjs → moonshine-stt-BO5gZ_D6.mjs} +300 -30
- package/dist/moonshine-stt-BO5gZ_D6.mjs.map +1 -0
- package/dist/moonshine-stt-fVw-UB4s.mjs +4 -0
- package/dist/{one-liner-qLcYdOfH.mjs → one-liner-X5vMbWzs.mjs} +2 -2
- package/dist/{one-liner-qLcYdOfH.mjs.map → one-liner-X5vMbWzs.mjs.map} +1 -1
- package/dist/outetts-DmR0NfSG.d.mts +219 -0
- package/dist/outetts-DmR0NfSG.d.mts.map +1 -0
- package/dist/{repl-RdQ2vKRz.mjs → repl-CGadrKcY.mjs} +3 -3
- package/dist/skills/index.d.mts +4 -3
- package/dist/skills/index.d.mts.map +1 -1
- package/dist/skills/index.mjs +3 -3
- package/dist/{skills-_q7U_ySm.mjs → skills-BFGAXYkm.mjs} +2 -2
- package/dist/{skills-_q7U_ySm.mjs.map → skills-BFGAXYkm.mjs.map} +1 -1
- package/dist/{types-LlyYILII.d.mts → types-Cpf-aOxX.d.mts} +25 -3
- package/dist/types-Cpf-aOxX.d.mts.map +1 -0
- package/dist/{types-DQBe2lFo.d.mts → types-Dqv4m0vo.d.mts} +1 -1
- package/dist/{types-DQBe2lFo.d.mts.map → types-Dqv4m0vo.d.mts.map} +1 -1
- package/package.json +2 -2
- package/dist/defaults-bJcmOaRG.mjs +0 -24
- package/dist/defaults-bJcmOaRG.mjs.map +0 -1
- package/dist/gerbil-BMZ5wnM_.mjs.map +0 -1
- package/dist/gerbil-BWKJtIYj.mjs +0 -4
- package/dist/gerbil-DkilSf1Q.d.mts.map +0 -1
- package/dist/gpu-BZHJDas1.mjs.map +0 -1
- package/dist/index-HVS7yeLx.d.mts.map +0 -1
- package/dist/moonshine-stt-Bj1zJfZg.mjs.map +0 -1
- package/dist/moonshine-stt-Eei7fh3N.mjs +0 -4
- package/dist/types-LlyYILII.d.mts.map +0 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region src/gpu/defaults.ts
|
|
2
|
+
/**
|
|
3
|
+
* Default model per capability. Kept in its own tiny module (no heavy imports)
|
|
4
|
+
* so the React hooks can resolve defaults without statically pulling in the GPU
|
|
5
|
+
* engine — they import the engine dynamically to stay light.
|
|
6
|
+
*/
|
|
7
|
+
const DEFAULT_MODELS = {
|
|
8
|
+
text: "mlx-community/Qwen3.5-0.8B-4bit",
|
|
9
|
+
vision: "mlx-community/Qwen3.5-0.8B-4bit",
|
|
10
|
+
embedding: "mlx-community/embeddinggemma-300m-4bit",
|
|
11
|
+
tts: "nineninesix/kani-tts-450m-0.2-ft",
|
|
12
|
+
ttsOute: "OuteAI/OuteTTS-1.0-0.6B",
|
|
13
|
+
stt: "UsefulSensors/moonshine-base"
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* OuteTTS auxiliary assets. The DAC.speech codec ships only `.pth` (non-safetensors),
|
|
17
|
+
* so the folded weights (prep-dac-speech.py output) and the preset speaker JSONs are
|
|
18
|
+
* hosted on the Cloudflare R2 model mirror (same public host the engine reads via
|
|
19
|
+
* GERBIL_MODEL_BASE — range + CORS, free egress, no redirect). Override via the OuteTTS
|
|
20
|
+
* options when self-hosting.
|
|
21
|
+
*/
|
|
22
|
+
const OUTETTS_ASSET_BASE = "https://pub-0522ecec25fc412bb35a523f3e3f63c6.r2.dev/tryhamster/gerbil-outetts-assets";
|
|
23
|
+
const OUTETTS_ASSETS = {
|
|
24
|
+
codecWeightsURL: `${OUTETTS_ASSET_BASE}/dac-speech-folded.safetensors`,
|
|
25
|
+
speakersBaseURL: `${OUTETTS_ASSET_BASE}/speakers`,
|
|
26
|
+
defaultVoice: "en-female-1-neutral"
|
|
27
|
+
};
|
|
28
|
+
/** Bundled OuteTTS preset voices (the edwko/OuteTTS v3 default_speakers set). */
|
|
29
|
+
const OUTETTS_PRESET_VOICES = [
|
|
30
|
+
"en-female-1-neutral",
|
|
31
|
+
"en-female-2-neutral",
|
|
32
|
+
"en-male-1-neutral",
|
|
33
|
+
"en-male-2-neutral",
|
|
34
|
+
"en-male-3-neutral",
|
|
35
|
+
"en-male-4-neutral"
|
|
36
|
+
];
|
|
37
|
+
/** Resolve the model repo for a set of options, falling back to the defaults. */
|
|
38
|
+
function resolveDefaultRepo(opts) {
|
|
39
|
+
if (opts.repo) return opts.repo;
|
|
40
|
+
if (opts.embedding) return DEFAULT_MODELS.embedding;
|
|
41
|
+
if (opts.enableVision) return DEFAULT_MODELS.vision;
|
|
42
|
+
return DEFAULT_MODELS.text;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { resolveDefaultRepo as i, OUTETTS_ASSETS as n, OUTETTS_PRESET_VOICES as r, DEFAULT_MODELS as t };
|
|
47
|
+
//# sourceMappingURL=defaults-CudhglS1.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults-CudhglS1.mjs","names":[],"sources":["../src/gpu/defaults.ts"],"sourcesContent":["/**\n * Default model per capability. Kept in its own tiny module (no heavy imports)\n * so the React hooks can resolve defaults without statically pulling in the GPU\n * engine — they import the engine dynamically to stay light.\n */\nexport const DEFAULT_MODELS = {\n /** Text generation (also the vision-capable checkpoint). */\n text: \"mlx-community/Qwen3.5-0.8B-4bit\",\n /** Image understanding — same checkpoint, vision tower built on demand. */\n vision: \"mlx-community/Qwen3.5-0.8B-4bit\",\n /** Text embeddings. */\n embedding: \"mlx-community/embeddinggemma-300m-4bit\",\n /** Text-to-speech (Apache-2.0; LFM2-350M backbone + NanoCodec). Small/fast default. */\n tts: \"nineninesix/kani-tts-450m-0.2-ft\",\n /**\n * Selectable many-voices TTS (OuteTTS-1.0-0.6B: Qwen3-0.6B codec-LM + DAC.speech).\n * Pass this as the `repo`/`model` to engine.speak()/useTTS to route to OuteTTS.\n */\n ttsOute: \"OuteAI/OuteTTS-1.0-0.6B\",\n /** Speech-to-text. */\n stt: \"UsefulSensors/moonshine-base\",\n} as const;\n\n/**\n * OuteTTS auxiliary assets. The DAC.speech codec ships only `.pth` (non-safetensors),\n * so the folded weights (prep-dac-speech.py output) and the preset speaker JSONs are\n * hosted on the Cloudflare R2 model mirror (same public host the engine reads via\n * GERBIL_MODEL_BASE — range + CORS, free egress, no redirect). Override via the OuteTTS\n * options when self-hosting.\n */\nconst OUTETTS_ASSET_BASE =\n \"https://pub-0522ecec25fc412bb35a523f3e3f63c6.r2.dev/tryhamster/gerbil-outetts-assets\";\nexport const OUTETTS_ASSETS = {\n /** Folded DAC.speech.v1.0 encoder+decoder weights (prep-dac-speech.py output). */\n codecWeightsURL: `${OUTETTS_ASSET_BASE}/dac-speech-folded.safetensors`,\n /** Base URL for the preset speaker JSONs (`{name}.json`). */\n speakersBaseURL: `${OUTETTS_ASSET_BASE}/speakers`,\n /** The default preset voice. */\n defaultVoice: \"en-female-1-neutral\",\n} as const;\n\n/** Bundled OuteTTS preset voices (the edwko/OuteTTS v3 default_speakers set). */\nexport const OUTETTS_PRESET_VOICES = [\n \"en-female-1-neutral\",\n \"en-female-2-neutral\",\n \"en-male-1-neutral\",\n \"en-male-2-neutral\",\n \"en-male-3-neutral\",\n \"en-male-4-neutral\",\n] as const;\n\n/** Resolve the model repo for a set of options, falling back to the defaults. */\nexport function resolveDefaultRepo(opts: {\n repo?: string;\n embedding?: boolean;\n enableVision?: boolean;\n}): string {\n if (opts.repo) return opts.repo;\n if (opts.embedding) return DEFAULT_MODELS.embedding;\n if (opts.enableVision) return DEFAULT_MODELS.vision;\n return DEFAULT_MODELS.text;\n}\n"],"mappings":";;;;;;AAKA,MAAa,iBAAiB;CAE5B,MAAM;CAEN,QAAQ;CAER,WAAW;CAEX,KAAK;CAKL,SAAS;CAET,KAAK;CACN;;;;;;;;AASD,MAAM,qBACJ;AACF,MAAa,iBAAiB;CAE5B,iBAAiB,GAAG,mBAAmB;CAEvC,iBAAiB,GAAG,mBAAmB;CAEvC,cAAc;CACf;;AAGD,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,SAAgB,mBAAmB,MAIxB;AACT,KAAI,KAAK,KAAM,QAAO,KAAK;AAC3B,KAAI,KAAK,UAAW,QAAO,eAAe;AAC1C,KAAI,KAAK,aAAc,QAAO,eAAe;AAC7C,QAAO,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express.d.mts","names":[],"sources":["../../src/frameworks/express.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"express.d.mts","names":[],"sources":["../../src/frameworks/express.ts"],"sourcesContent":[],"mappings":";;;;;;UAuBiB,oBAAA,SAA6B,KAAK;;;;;;;iBAQnC,MAAA,WAAgB,6BAgBE;;;;iBAqGlB,OAAA,WAAiB,6BAKZ,cAAc,aAAQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __require } from "../chunk-B9cbKln6.mjs";
|
|
2
|
-
import { r as DEFAULT_MODEL, t as Gerbil } from "../gerbil-
|
|
2
|
+
import { r as DEFAULT_MODEL, t as Gerbil } from "../gerbil-Du-1M2Wq.mjs";
|
|
3
3
|
import "../utils-DKO55ZmZ.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/frameworks/express.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastify.d.mts","names":[],"sources":["../../src/frameworks/fastify.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fastify.d.mts","names":[],"sources":["../../src/frameworks/fastify.ts"],"sourcesContent":[],"mappings":";;;;;UAiBiB,oBAAA,SAA6B;;;iBAIxB,YAAA,yBAAoC,uBAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hono.d.mts","names":[],"sources":["../../src/frameworks/hono.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hono.d.mts","names":[],"sources":["../../src/frameworks/hono.ts"],"sourcesContent":[],"mappings":";;;;;;;AAsBsD,UALrC,iBAAA,SAA0B,YAKW,CAAA;;;;iBAAtC,MAAA,WAAgB,0BAAsB,QAAA,KAAA,CAAA,KAAA,WAAA,CAAA,QAAA,EAAA,WAAA,CAAA,WAAA"}
|
package/dist/frameworks/hono.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "../
|
|
3
|
-
import
|
|
1
|
+
import "../outetts-DmR0NfSG.mjs";
|
|
2
|
+
import { d as GerbilConfig } from "../types-Cpf-aOxX.mjs";
|
|
3
|
+
import "../index-C4kJrqs1.mjs";
|
|
4
|
+
import { t as Gerbil } from "../gerbil-4Xid85_Z.mjs";
|
|
4
5
|
|
|
5
6
|
//#region src/frameworks/next.d.ts
|
|
6
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.mts","names":[],"sources":["../../src/frameworks/next.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"next.d.mts","names":[],"sources":["../../src/frameworks/next.ts"],"sourcesContent":[],"mappings":";;;;;;;AAgDoD,UA9BnC,iBAAA,SAA0B,YA8BS,CAAA;EAAR;EAAO,OAAA,CAAA,EAAA,OAAA;AA2CnD;iBAhEe,WAAA,CAgEyB,OAAA,EAhEJ,iBAgEI,CAAA,EAhEgB,OAgEhB,CAhEwB,MAgExB,CAAA;;;;AAIpB,iBAhDJ,OAAA,CAgDI,OAAA,CAAA,EAhDa,iBAgDb,CAAA,EAAA,CAAA,GAAA,EA/Cc,OA+Cd,EAAA,GA/CwB,OA+CxB,CA/CgC,QA+ChC,CAAA;;;;AAgBmB,iBApBvB,cAAA,CAoBuB,OAAA,CAAA,EApBC,iBAoBD,CAAA,EAAA;EAAR,QAAA,EAAA,CAAA,GAAA,EA/DG,OA+DH,EAAA,GA/Da,OA+Db,CA/DqB,QA+DrB,CAAA;EAiBV,IAAA,CAAA,GAAA,EAjCD,OAiCC,CAAA,EAjCS,OAiCT,CAjCiB,QAiCjB,CAAA;EAAkB,KAAA,CAAA,GAAA,EAjBlB,OAiBkB,CAAA,EAjBR,OAiBQ,CAjBA,QAiBA,CAAA;EAAR,IAAA,CAAA,IAAA,EAAV,OAAU,CAAA,EAAA,OAAA,CAAQ,QAAR,CAAA;CAAO;AAWzB,cAAA,MAIZ,EAAA"}
|
package/dist/frameworks/next.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../outetts-DmR0NfSG.mjs";
|
|
2
|
+
import { d as GerbilConfig, l as GenerateOptions, u as GenerateResult } from "../types-Cpf-aOxX.mjs";
|
|
2
3
|
|
|
3
4
|
//#region src/frameworks/react.d.ts
|
|
4
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.mts","names":[],"sources":["../../src/frameworks/react.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"react.d.mts","names":[],"sources":["../../src/frameworks/react.ts"],"sourcesContent":[],"mappings":";;;;;AA4NY,UAvMK,gBAAA,SAAyB,YAuM9B,CAAA;EAGS;EAAoB,QAAA,CAAA,EAAA,MAAA;EAEhC;EAAK,WAAA,CAAA,EAAA,OAAA;AAId;KAxMY,eAAA;;uCAE2B,oBAAoB,QAAQ;;qCAG9B,oBAAoB;;;;SAMhD;;;;UAMC;;;;;;;iBASM,SAAA,WAAmB,mBAAwB;;;;KAuJ/C,OAAA;;;;UAKK,cAAA,SAAuB;;oBAEpB;;;;KAMR,aAAA;YACA;;;qBAGS,KAAA,CAAM,cAAc;;SAEhC;;;iBAIO,OAAA,WAAiB,iBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trpc.d.mts","names":[],"sources":["../../src/frameworks/trpc.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"trpc.d.mts","names":[],"sources":["../../src/frameworks/trpc.ts"],"sourcesContent":[],"mappings":";;;;;UAqBiB,iBAAA,SAA0B;;;;iBAK3B,YAAA,mBAA8B"}
|
package/dist/frameworks/trpc.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
1
|
+
import { i as OuteSpeaker } from "./outetts-DmR0NfSG.mjs";
|
|
2
|
+
import { A as SpeakResult, C as PreloadOptions, D as SessionStats, E as SearchResult, I as TranscribeOptions, L as TranscribeResult, M as StreamingTranscriptionSession, N as SystemInfo, O as SimilarityResult, T as STTModelConfig, _ as LoadSTTOptions, a as EmbedResult, d as GerbilConfig, g as LoadOptions, h as JsonOptions, i as EmbedOptions, j as StreamingTranscriptionOptions, k as SpeakOptions, l as GenerateOptions, t as AudioChunk, u as GenerateResult, v as LoadTTSOptions, y as ModelConfig, z as VoiceInfo } from "./types-Cpf-aOxX.mjs";
|
|
3
|
+
import { a as GenerateObjectOptions, o as GenerateObjectResult } from "./index-C4kJrqs1.mjs";
|
|
3
4
|
|
|
4
5
|
//#region src/core/gerbil.d.ts
|
|
5
6
|
|
|
@@ -14,6 +15,7 @@ declare class Gerbil {
|
|
|
14
15
|
private nativeEmbedRepo;
|
|
15
16
|
private nativeSTT;
|
|
16
17
|
private nativeTTSEngine;
|
|
18
|
+
private nativeTTSRepo;
|
|
17
19
|
private isVisionModel;
|
|
18
20
|
private readonly queue;
|
|
19
21
|
private readonly telemetry;
|
|
@@ -315,7 +317,7 @@ declare class Gerbil {
|
|
|
315
317
|
* // result.audio = Float32Array PCM, result.sampleRate = 22050
|
|
316
318
|
* ```
|
|
317
319
|
*/
|
|
318
|
-
loadTTS(
|
|
320
|
+
loadTTS(options?: LoadTTSOptions & {
|
|
319
321
|
model?: string;
|
|
320
322
|
}): Promise<void>;
|
|
321
323
|
/**
|
|
@@ -332,8 +334,29 @@ declare class Gerbil {
|
|
|
332
334
|
* ```
|
|
333
335
|
*/
|
|
334
336
|
speak(text: string, options?: SpeakOptions): Promise<SpeakResult>;
|
|
335
|
-
/**
|
|
337
|
+
/**
|
|
338
|
+
* Lazily build (or reuse) the native TTS WebGPUEngine for the requested model.
|
|
339
|
+
* Defaults to the small/fast Kani-TTS; selecting a different TTS repo (e.g. the
|
|
340
|
+
* OuteTTS many-voices engine) rebuilds the engine for that checkpoint.
|
|
341
|
+
*/
|
|
336
342
|
private ensureNativeTTSEngine;
|
|
343
|
+
/** List the voices the active (or default) TTS engine supports. */
|
|
344
|
+
ttsVoices(model?: string): Promise<string[]>;
|
|
345
|
+
/**
|
|
346
|
+
* OuteTTS voice cloning: encode a raw reference clip (mono PCM + transcript) into a
|
|
347
|
+
* reusable speaker, then synthesize new text in that voice via
|
|
348
|
+
* `speak(text, { model: DEFAULT_MODELS.ttsOute, cloneSpeaker })`.
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* const g = createGerbil();
|
|
352
|
+
* const speaker = await g.encodeSpeaker({ audio, sampleRate, transcript }, DEFAULT_MODELS.ttsOute);
|
|
353
|
+
* const out = await g.speak("New words in the cloned voice.", { model: DEFAULT_MODELS.ttsOute, cloneSpeaker: speaker });
|
|
354
|
+
*/
|
|
355
|
+
encodeSpeaker(ref: {
|
|
356
|
+
audio: Float32Array;
|
|
357
|
+
sampleRate: number;
|
|
358
|
+
transcript: string;
|
|
359
|
+
}, model?: string): Promise<OuteSpeaker>;
|
|
337
360
|
/**
|
|
338
361
|
* Stream speech generation. The native engine synthesizes the full clip, so a
|
|
339
362
|
* single final audio chunk is yielded.
|
|
@@ -356,7 +379,9 @@ declare class Gerbil {
|
|
|
356
379
|
device?: "webgpu" | "cpu";
|
|
357
380
|
} | null;
|
|
358
381
|
/**
|
|
359
|
-
* List available TTS models
|
|
382
|
+
* List available native TTS models: the default small/fast Kani-TTS and the
|
|
383
|
+
* selectable many-voices OuteTTS. Pass an OuteTTS `id` as `speak({ model })` /
|
|
384
|
+
* `loadTTS({ model })` to use it.
|
|
360
385
|
*/
|
|
361
386
|
listTTSModels(): Promise<Array<{
|
|
362
387
|
id: string;
|
|
@@ -485,4 +510,4 @@ declare class Gerbil {
|
|
|
485
510
|
}
|
|
486
511
|
//#endregion
|
|
487
512
|
export { Gerbil as t };
|
|
488
|
-
//# sourceMappingURL=gerbil-
|
|
513
|
+
//# sourceMappingURL=gerbil-4Xid85_Z.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gerbil-4Xid85_Z.d.mts","names":[],"sources":["../src/core/gerbil.ts"],"sourcesContent":[],"mappings":";;;;;;AAgPsB,cAxBT,MAAA,CAwBS;EAgDC,QAAA,YAAA;EAIa,QAAA,WAAA;EA0BgB,iBAAA,MAAA;EAAmB,QAAA,KAAA;EAoLrD,QAAA,WAAA;EAyDsB,QAAA,YAAA;EAyCO,QAAA,iBAAA;EAAsB,QAAA,eAAA;EAqC7B,QAAA,SAAA;EAWM,QAAA,eAAA;EAAsB,QAAA,aAAA;EAgC5B,QAAA,aAAA;EAWM,iBAAA,KAAA;EAAsB,iBAAA,SAAA;EAgCvB,WAAA,CAAA,MAAA,CAAA,EA/dvB,YA+duB;EAWO,QAAA,WAAA;EAAsB;;;;;EAmQ7D,QAAA,YAAA;EACe,OAAA,UAAA,CAAA,CAAA,EA9rBL,WA8rBK,EAAA;EAAvB,OAAA,QAAA,CAAA,OAAA,EAAA,MAAA,CAAA,EA1rB+B,WA0rB/B,GAAA,SAAA;EA6MgD;;;;;;;;;;;;;;;;;;EA2M5B,SAAA,CAAA,OAAA,CAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAxjC2B,WAwjC3B,CAAA,EAxjC8C,OAwjC9C,CAAA,IAAA,CAAA;EACpB;;;;;;EAqHoB,QAAA,eAAA;EAA2C;;;EAoB/B,QAAA,CAAA,CAAA,EAAA,OAAA;EAA4B;;;EAoE/C,cAAA,CAAA,CAAA,EAAA,OAAA;EAEL;;;EAaO,YAAA,CAAA,CAAA,EAjmCF,WAimCE,GAAA,IAAA;EAAY;;;EA8C5B,aAAA,CAAA,CAAA,EAAA,QAAA,GAAA,KAAA,GAAA,MAAA;EADqB;;;;;EAsEd,QAAA,CAAA,CAAA,EAAA,MAAA;EAAe;;;EAErB,qBAAA,CAAA,CAAA,EAAA;IAoES,IAAA,EAAA,MAAA;IACD,MAAA,EAAA,MAAA;IAAR,IAAA,EAAA,MAAA;IAW4B,OAAA,EAAA,MAAA;EAAR,CAAA;EAyDZ;;;EAqDyB,kBAAA,CAAA,CAAA,EAAA,IAAA;EAmDX;;;;;;;;;;;;kCA94Ca;;;;;;;;;;;;;;;;;;;;;;;;0CAyCO,iBAAsB;;;;;kCAqC7B;;;;;;;yCAWM,iBAAsB;;;;;kCAgC5B;;;;;;;yCAWM,iBAAsB;;;;;uCAgCvB;;;;;;;+CAWO,iBAAsB;;;;;;gBAmCpD;;;;;;;;;;;;;;;qCAsBoB,kBAAuB,QAAQ;;;;;;;;;;;mCA0M5D,kBACR,uBAAuB;;;;;;;;;;;;;;;;;;;mCA6Ma,YAAY,KAAK,QAAQ;;;;;;;;;;;;;;;;;wDAgDrD,wBACR,QAAQ,qBAAqB;;;;gCAiBG,eAAoB,QAAQ;;;;;;;;;;wCAoDpB,eAAoB,QAAQ;;;;;;;;;;;;;;;;;;;;qDAkD5D,eACR,QADyB,gBAAA;;;;;;;;;;;;;;oDAmCjB;;MACR,QADoB,YAAA;;;;;;;;;;;mEAgCZ;;MACR,QADoB,YAAA;;;;cAyBX;;;;aAOD;;;;;;;;;;;;;;;;oBAsDY;;MAA2C;;;;6BAOjC,iBAAiB;;;;;;;;;;gCAaf,eAAoB,QAAQ;;;;;;;;6BAoD9B;;;;;;;;;;;;WAgBjB;;;sBAEb,QAAQ;;;;;sCAYA,eACR,eAAe,YAAY;;;;gBAchB;;;;;;;;;;;;;;;;;;mBA+BS,QACrB;;;;;;;;;;;;;;;;wCAiCyC,iBAAsB;;;;gDAQN,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;oBA4BnE,eAAe,sBACb,oBACR,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CAoEC,gCACT,QAAQ;;;;mBAWY,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAyD5B,QAAQ;;;;2BAmCoB;;;;;kCAkBK;;;;qBAmDX"}
|
|
@@ -464,6 +464,7 @@ var Gerbil = class {
|
|
|
464
464
|
nativeEmbedRepo = null;
|
|
465
465
|
nativeSTT = null;
|
|
466
466
|
nativeTTSEngine = null;
|
|
467
|
+
nativeTTSRepo = null;
|
|
467
468
|
isVisionModel = false;
|
|
468
469
|
queue;
|
|
469
470
|
telemetry;
|
|
@@ -1340,8 +1341,8 @@ The JSON must conform to this schema: ${JSON.stringify(zodToJsonSchema(schema))}
|
|
|
1340
1341
|
* // result.audio = Float32Array PCM, result.sampleRate = 22050
|
|
1341
1342
|
* ```
|
|
1342
1343
|
*/
|
|
1343
|
-
async loadTTS(
|
|
1344
|
-
await this.ensureNativeTTSEngine();
|
|
1344
|
+
async loadTTS(options = {}) {
|
|
1345
|
+
await this.ensureNativeTTSEngine(options.model);
|
|
1345
1346
|
}
|
|
1346
1347
|
/**
|
|
1347
1348
|
* Ensure TTS model is loaded (lazy loading)
|
|
@@ -1360,9 +1361,15 @@ The JSON must conform to this schema: ${JSON.stringify(zodToJsonSchema(schema))}
|
|
|
1360
1361
|
*/
|
|
1361
1362
|
async speak(text, options = {}) {
|
|
1362
1363
|
if (!this.preferNative()) throw new Error("Speech synthesis requires WebGPU. CPU/WASM and the legacy ONNX backend have been removed.");
|
|
1363
|
-
const native = await this.ensureNativeTTSEngine();
|
|
1364
|
+
const native = await this.ensureNativeTTSEngine(options.model);
|
|
1364
1365
|
const startTime = performance.now();
|
|
1365
|
-
const out = await native.speak(text, {
|
|
1366
|
+
const out = await native.speak(text, {
|
|
1367
|
+
voice: options.voice,
|
|
1368
|
+
temperature: options.temperature,
|
|
1369
|
+
topP: options.topP,
|
|
1370
|
+
topK: options.topK,
|
|
1371
|
+
cloneSpeaker: options.cloneSpeaker
|
|
1372
|
+
});
|
|
1366
1373
|
return {
|
|
1367
1374
|
audio: out.pcm,
|
|
1368
1375
|
sampleRate: out.sampleRate,
|
|
@@ -1371,14 +1378,38 @@ The JSON must conform to this schema: ${JSON.stringify(zodToJsonSchema(schema))}
|
|
|
1371
1378
|
totalTime: performance.now() - startTime
|
|
1372
1379
|
};
|
|
1373
1380
|
}
|
|
1374
|
-
/**
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1381
|
+
/**
|
|
1382
|
+
* Lazily build (or reuse) the native TTS WebGPUEngine for the requested model.
|
|
1383
|
+
* Defaults to the small/fast Kani-TTS; selecting a different TTS repo (e.g. the
|
|
1384
|
+
* OuteTTS many-voices engine) rebuilds the engine for that checkpoint.
|
|
1385
|
+
*/
|
|
1386
|
+
async ensureNativeTTSEngine(model) {
|
|
1387
|
+
const { WebGPUEngine, DEFAULT_MODELS } = await import("./gpu/index.mjs");
|
|
1388
|
+
const repo = model ?? DEFAULT_MODELS.tts;
|
|
1389
|
+
if (this.nativeTTSEngine && this.nativeTTSRepo === repo) return this.nativeTTSEngine;
|
|
1390
|
+
if (this.nativeTTSEngine) this.nativeTTSEngine.destroy?.();
|
|
1391
|
+
this.nativeTTSEngine = await WebGPUEngine.create({ repo });
|
|
1392
|
+
this.nativeTTSRepo = repo;
|
|
1380
1393
|
return this.nativeTTSEngine;
|
|
1381
1394
|
}
|
|
1395
|
+
/** List the voices the active (or default) TTS engine supports. */
|
|
1396
|
+
async ttsVoices(model) {
|
|
1397
|
+
return (await this.ensureNativeTTSEngine(model)).ttsVoices?.() ?? [];
|
|
1398
|
+
}
|
|
1399
|
+
/**
|
|
1400
|
+
* OuteTTS voice cloning: encode a raw reference clip (mono PCM + transcript) into a
|
|
1401
|
+
* reusable speaker, then synthesize new text in that voice via
|
|
1402
|
+
* `speak(text, { model: DEFAULT_MODELS.ttsOute, cloneSpeaker })`.
|
|
1403
|
+
*
|
|
1404
|
+
* @example
|
|
1405
|
+
* const g = createGerbil();
|
|
1406
|
+
* const speaker = await g.encodeSpeaker({ audio, sampleRate, transcript }, DEFAULT_MODELS.ttsOute);
|
|
1407
|
+
* const out = await g.speak("New words in the cloned voice.", { model: DEFAULT_MODELS.ttsOute, cloneSpeaker: speaker });
|
|
1408
|
+
*/
|
|
1409
|
+
async encodeSpeaker(ref, model) {
|
|
1410
|
+
const { DEFAULT_MODELS } = await import("./gpu/index.mjs");
|
|
1411
|
+
return (await this.ensureNativeTTSEngine(model ?? DEFAULT_MODELS.ttsOute)).encodeSpeaker(ref);
|
|
1412
|
+
}
|
|
1382
1413
|
/**
|
|
1383
1414
|
* Stream speech generation. The native engine synthesizes the full clip, so a
|
|
1384
1415
|
* single final audio chunk is yielded.
|
|
@@ -1417,14 +1448,21 @@ The JSON must conform to this schema: ${JSON.stringify(zodToJsonSchema(schema))}
|
|
|
1417
1448
|
};
|
|
1418
1449
|
}
|
|
1419
1450
|
/**
|
|
1420
|
-
* List available TTS models
|
|
1451
|
+
* List available native TTS models: the default small/fast Kani-TTS and the
|
|
1452
|
+
* selectable many-voices OuteTTS. Pass an OuteTTS `id` as `speak({ model })` /
|
|
1453
|
+
* `loadTTS({ model })` to use it.
|
|
1421
1454
|
*/
|
|
1422
1455
|
async listTTSModels() {
|
|
1423
1456
|
return [{
|
|
1424
1457
|
id: this.ttsModelId,
|
|
1425
|
-
description: "Kani-TTS
|
|
1458
|
+
description: "Kani-TTS native WebGPU TTS (small/fast, default)",
|
|
1426
1459
|
sampleRate: 22050,
|
|
1427
1460
|
voiceCount: 1
|
|
1461
|
+
}, {
|
|
1462
|
+
id: "OuteAI/OuteTTS-1.0-0.6B",
|
|
1463
|
+
description: "OuteTTS-1.0-0.6B native WebGPU TTS (many voices + cloning)",
|
|
1464
|
+
sampleRate: 24e3,
|
|
1465
|
+
voiceCount: 6
|
|
1428
1466
|
}];
|
|
1429
1467
|
}
|
|
1430
1468
|
/**
|
|
@@ -1486,7 +1524,7 @@ The JSON must conform to this schema: ${JSON.stringify(zodToJsonSchema(schema))}
|
|
|
1486
1524
|
/** Lazily build (or reuse) the native MoonshineSTT engine (default repo). */
|
|
1487
1525
|
async ensureNativeSTT() {
|
|
1488
1526
|
if (!this.nativeSTT) {
|
|
1489
|
-
const { MoonshineSTT } = await import("./moonshine-stt-
|
|
1527
|
+
const { MoonshineSTT } = await import("./moonshine-stt-fVw-UB4s.mjs");
|
|
1490
1528
|
this.nativeSTT = await MoonshineSTT.create();
|
|
1491
1529
|
}
|
|
1492
1530
|
return this.nativeSTT;
|
|
@@ -1653,4 +1691,4 @@ The JSON must conform to this schema: ${JSON.stringify(zodToJsonSchema(schema))}
|
|
|
1653
1691
|
|
|
1654
1692
|
//#endregion
|
|
1655
1693
|
export { resolveModel as a, configureGlobalCache as c, listBuiltinModels as i, getGlobalCache as l, BUILTIN_MODELS as n, ResponseCache as o, DEFAULT_MODEL as r, clearGlobalCache as s, Gerbil as t };
|
|
1656
|
-
//# sourceMappingURL=gerbil-
|
|
1694
|
+
//# sourceMappingURL=gerbil-Du-1M2Wq.mjs.map
|