From 7b81d9b4a221ca17525913fb8ea1ca246cfa71fc Mon Sep 17 00:00:00 2001 From: akirilyuk Date: Tue, 10 Nov 2026 00:01:52 +0700 Subject: [PATCH 1/2] feat(voice-advanced): speaker gate tuning keys and engine cross-field checks (0.24.0) --- CHANGELOG.md | 12 + README.md | 14 + package-lock.json | 12 +- package.json | 4 +- .../projects/voice-advanced/commands.test.ts | 276 ++++++++++++++++++ .../projects/voice-advanced/definitions.ts | 75 ++++- src/commands/projects/voice-advanced/set.ts | 5 + 7 files changed, 384 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8612685..f35b732 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,18 @@ Format based on [Keep a Changelog](https://keepachangelog.com/). Versioning foll ## [Unreleased] +## [0.24.0] - 2026-11-09 + +### Added + +- `voicethere projects voice-advanced` lists and sets the speaker gate tuning keys `speakerGate.splitOnSpeakerChange`, `speakerGate.recheckOnOther`, `speakerGate.recheckMaxWindows`, `speakerGate.threshold`, `speakerGate.enrollSpeechMs`, `speakerGate.checkSpeechMs` and `speakerGate.minCheckSpeechMs`. They show up once the platform returns them; against a platform that does not, `set` types them from the voice engine catalog. +- `set` checks the voice engine's cross-field rules locally, in every `speakerGate.mode`: `speakerGate.recheckMaxWindows` 1 is rejected while `speakerGate.recheckOnOther` or `speakerGate.splitOnSpeakerChange` is on, and `speakerGate.checkSpeechMs` must be at least `speakerGate.minCheckSpeechMs`. The error carries the engine's message. The server stays the final check. + +### Changed + +- `speakerGate.threshold` must be above 0 and below 1; 0 and 1 are rejected as outside the engine range. `list` shows such a range in parentheses. +- `@node-webrtc-rust/voice-catalog` is now 0.18.2. + ## [0.23.0] - 2026-11-08 ### Changed diff --git a/README.md b/README.md index 1c0598e..e49eadd 100644 --- a/README.md +++ b/README.md @@ -492,11 +492,25 @@ voicethere projects voice-advanced set vad.adaptive.noiseMarginDb 9 | `speakerGate.mode` | `disabled`, `auto`, `manual` | `disabled` | | `speakerGate.bargeIn` | `caller_only`, `anyone` | `caller_only` | | `speakerGate.suppressShortBargeIn` | bool | `false` | +| `speakerGate.splitOnSpeakerChange` | bool | `false` | +| `speakerGate.recheckOnOther` | bool | `true` | +| `speakerGate.recheckMaxWindows` | whole number, 0 = no cap | `12` | +| `speakerGate.threshold` | above 0 and below 1 | `0.459` | +| `speakerGate.enrollSpeechMs` | whole number (ms) | `3000` | +| `speakerGate.checkSpeechMs` | whole number (ms) | `1500` | +| `speakerGate.minCheckSpeechMs` | whole number (ms) | `1500` | | `vad.provider` | `energy`, `adaptive` | `energy` | | `vad.adaptive.noiseMarginDb` | 0–30 (dB above the noise floor) | `6` | | `vad.adaptive.useSpeechLevel` | bool | `true` | | `vad.adaptive.stuckActiveMs` | 1000–60000 | `8000` | +The platform may cap the speaker gate numbers below the engine range; `list` shows the range that applies. Two rules hold in every `speakerGate.mode`, and `set` checks them before it sends anything (the server still has the final say): + +- `speakerGate.recheckMaxWindows` must not be `1` while `speakerGate.recheckOnOther` or `speakerGate.splitOnSpeakerChange` is `true`. Use `0` (no cap), `2` or more, or turn both off first. +- `speakerGate.checkSpeechMs` must be at least `speakerGate.minCheckSpeechMs`. + +`speakerGate.splitOnSpeakerChange` ends an utterance when the caller's speech runs straight into another voice, so the caller's text does not carry the other person's words. + ## Language switch settings Spoken-language auto-switch and its wait behavior are advanced voice settings. They apply on the next **`voicethere deploy --wait`**. When the caller switches to a language whose models are not running yet, the runner starts them on demand and can play a short wait message in the language being left. diff --git a/package-lock.json b/package-lock.json index a7312fb..ef4129b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "@voicethere/cli", - "version": "0.23.0", + "version": "0.24.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@voicethere/cli", - "version": "0.23.0", + "version": "0.24.0", "license": "MIT", "dependencies": { - "@node-webrtc-rust/voice-catalog": "0.18.0", + "@node-webrtc-rust/voice-catalog": "0.18.2", "@voicethere/agent": "0.29.1", "commander": "13.1.0", "diff": "5.2.0", @@ -649,9 +649,9 @@ } }, "node_modules/@node-webrtc-rust/voice-catalog": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/@node-webrtc-rust/voice-catalog/-/voice-catalog-0.18.0.tgz", - "integrity": "sha512-AzHATkrBjQksxoHlOFuK5PYL0mIm7x0Wqccot0+6qgeMgPruES9fRHh8W4v5PjQIDd2TQMcLuQdyXQ7bzjVB9A==", + "version": "0.18.2", + "resolved": "https://registry.npmjs.org/@node-webrtc-rust/voice-catalog/-/voice-catalog-0.18.2.tgz", + "integrity": "sha512-k5IE6y12acTVCDLcui/8xgIQrnKRdlzz2ymAiBACPt51FkPKWycaUNpQD/WULTCIrsa6D6WhGMf4jdijAXyvLw==", "license": "BUSL-1.1", "engines": { "node": ">=18" diff --git a/package.json b/package.json index cae4cb1..921dbbf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@voicethere/cli", - "version": "0.23.0", + "version": "0.24.0", "description": "VoiceThere cloud CLI — login, projects, and agent bundle upload", "type": "module", "bin": { @@ -38,7 +38,7 @@ }, "license": "MIT", "dependencies": { - "@node-webrtc-rust/voice-catalog": "0.18.0", + "@node-webrtc-rust/voice-catalog": "0.18.2", "@voicethere/agent": "0.29.1", "commander": "13.1.0", "diff": "5.2.0", diff --git a/src/commands/projects/voice-advanced/commands.test.ts b/src/commands/projects/voice-advanced/commands.test.ts index df930ef..f2ddd86 100644 --- a/src/commands/projects/voice-advanced/commands.test.ts +++ b/src/commands/projects/voice-advanced/commands.test.ts @@ -96,6 +96,59 @@ const DEFINITIONS: VoiceAdvancedDefinition[] = [ max: 2, }), def({ key: "tts.phraseCache", type: "boolean", default: true }), + def({ + key: "speakerGate.splitOnSpeakerChange", + type: "boolean", + default: false, + engineKey: "speakerGate.splitOnSpeakerChange", + }), + def({ + key: "speakerGate.recheckOnOther", + type: "boolean", + default: true, + engineKey: "speakerGate.recheckOnOther", + }), + def({ + key: "speakerGate.recheckMaxWindows", + type: "number", + default: 12, + min: 0, + max: 50, + engineKey: "speakerGate.recheckMaxWindows", + }), + def({ + key: "speakerGate.threshold", + type: "number", + default: 0.459, + integer: false, + min: 0.1, + max: 0.8, + engineKey: "speakerGate.threshold", + }), + def({ + key: "speakerGate.enrollSpeechMs", + type: "number", + default: 3000, + min: 1000, + max: 10000, + engineKey: "speakerGate.enrollSpeechMs", + }), + def({ + key: "speakerGate.checkSpeechMs", + type: "number", + default: 1500, + min: 500, + max: 5000, + engineKey: "speakerGate.checkSpeechMs", + }), + def({ + key: "speakerGate.minCheckSpeechMs", + type: "number", + default: 1500, + min: 500, + max: 5000, + engineKey: "speakerGate.minCheckSpeechMs", + }), def({ key: "voice.profilesByLanguage", type: "string", default: "{}" }), ]; @@ -254,6 +307,229 @@ describe("projects voice-advanced", () => { }); }); + describe("speakerGate keys", () => { + const gateSettings = (over: Record = {}) => ({ + speakerGate: { + mode: "disabled", + splitOnSpeakerChange: false, + recheckOnOther: true, + recheckMaxWindows: 12, + threshold: 0.459, + enrollSpeechMs: 3000, + checkSpeechMs: 1500, + minCheckSpeechMs: 1500, + ...over, + }, + }); + + it("list prints all 7 speakerGate keys with defaults, threshold range open-ended", async () => { + listProjectVoiceAdvancedSettings.mockResolvedValue({ + settings: gateSettings(), + definitions: DEFINITIONS, + }); + await runProjectsVoiceAdvancedList(); + const lines = vi.mocked(console.log).mock.calls.map((c) => String(c[0])); + for (const k of [ + "splitOnSpeakerChange", + "recheckMaxWindows", + "recheckOnOther", + "threshold", + "enrollSpeechMs", + "checkSpeechMs", + "minCheckSpeechMs", + ]) { + expect(lines.some((l) => l.startsWith(`speakerGate.${k}=`))).toBe(true); + } + expect(lines).toContain( + "speakerGate.threshold=0.459 (default 0.459 [0.1–0.8])", + ); + }); + + it("threshold 1 fails the engine range (exclusive), 0 too, 0.85 fails the API cap", async () => { + listProjectVoiceAdvancedSettings.mockResolvedValue({ + settings: gateSettings(), + definitions: DEFINITIONS, + }); + await expect( + runProjectsVoiceAdvancedSet({ + name: "speakerGate.threshold", + value: "1", + }), + ).rejects.toThrow(/engine range/); + await expect( + runProjectsVoiceAdvancedSet({ + name: "speakerGate.threshold", + value: "0", + }), + ).rejects.toThrow(/engine range/); + await expect( + runProjectsVoiceAdvancedSet({ + name: "speakerGate.threshold", + value: "0.85", + }), + ).rejects.toThrow(/between 0\.1 and 0\.8$/); + expect(setProjectVoiceAdvancedSetting).not.toHaveBeenCalled(); + await runProjectsVoiceAdvancedSet({ + name: "speakerGate.threshold", + value: "0.5", + }); + expect(setProjectVoiceAdvancedSetting).toHaveBeenCalledWith( + "proj-1", + "speakerGate.threshold", + 0.5, + ); + }); + + it("R1: splitOnSpeakerChange true with recheckMaxWindows 1 is rejected locally with the engine message", async () => { + listProjectVoiceAdvancedSettings.mockResolvedValue({ + settings: gateSettings({ recheckMaxWindows: 1, recheckOnOther: false }), + definitions: DEFINITIONS, + }); + await expect( + runProjectsVoiceAdvancedSet({ + name: "speakerGate.splitOnSpeakerChange", + value: "true", + }), + ).rejects.toThrow(/recheckMaxWindows must be 0 \(no cap\) or at least 2/); + expect(setProjectVoiceAdvancedSetting).not.toHaveBeenCalled(); + }); + + it("R1 applies in mode disabled, and from the recheckMaxWindows side", async () => { + listProjectVoiceAdvancedSettings.mockResolvedValue({ + settings: gateSettings({ mode: "disabled" }), + definitions: DEFINITIONS, + }); + await expect( + runProjectsVoiceAdvancedSet({ + name: "speakerGate.recheckMaxWindows", + value: "1", + }), + ).rejects.toThrow(/at least 2/); + expect(setProjectVoiceAdvancedSetting).not.toHaveBeenCalled(); + }); + + it("R1 allows 1 window once both rechecks are off, and 0 with the split on", async () => { + listProjectVoiceAdvancedSettings.mockResolvedValue({ + settings: gateSettings({ + recheckOnOther: false, + splitOnSpeakerChange: false, + }), + definitions: DEFINITIONS, + }); + await runProjectsVoiceAdvancedSet({ + name: "speakerGate.recheckMaxWindows", + value: "1", + }); + expect(setProjectVoiceAdvancedSetting).toHaveBeenCalledTimes(1); + listProjectVoiceAdvancedSettings.mockResolvedValue({ + settings: gateSettings({ splitOnSpeakerChange: true }), + definitions: DEFINITIONS, + }); + await runProjectsVoiceAdvancedSet({ + name: "speakerGate.recheckMaxWindows", + value: "0", + }); + expect(setProjectVoiceAdvancedSetting).toHaveBeenCalledTimes(2); + }); + + it("R2: checkSpeechMs below minCheckSpeechMs is rejected, equal passes", async () => { + listProjectVoiceAdvancedSettings.mockResolvedValue({ + settings: gateSettings(), + definitions: DEFINITIONS, + }); + await expect( + runProjectsVoiceAdvancedSet({ + name: "speakerGate.checkSpeechMs", + value: "1000", + }), + ).rejects.toThrow(/checkSpeechMs must be at least .*minCheckSpeechMs/); + await expect( + runProjectsVoiceAdvancedSet({ + name: "speakerGate.minCheckSpeechMs", + value: "2000", + }), + ).rejects.toThrow(/checkSpeechMs must be at least/); + expect(setProjectVoiceAdvancedSetting).not.toHaveBeenCalled(); + await runProjectsVoiceAdvancedSet({ + name: "speakerGate.checkSpeechMs", + value: "1500", + }); + expect(setProjectVoiceAdvancedSetting).toHaveBeenCalledTimes(1); + }); + + it("an unrelated key is not blocked by an older broken combination", async () => { + listProjectVoiceAdvancedSettings.mockResolvedValue({ + settings: gateSettings({ recheckMaxWindows: 1 }), + definitions: DEFINITIONS, + }); + await runProjectsVoiceAdvancedSet({ + name: "speakerGate.enrollSpeechMs", + value: "4000", + }); + expect(setProjectVoiceAdvancedSetting).toHaveBeenCalledWith( + "proj-1", + "speakerGate.enrollSpeechMs", + 4000, + ); + }); + + it("a server 400 is shown as is", async () => { + listProjectVoiceAdvancedSettings.mockResolvedValue({ + settings: gateSettings(), + definitions: DEFINITIONS, + }); + setProjectVoiceAdvancedSetting.mockRejectedValue( + new Error("HTTP 400: speakerGate.threshold is not allowed on this plan"), + ); + await expect( + runProjectsVoiceAdvancedSet({ + name: "speakerGate.threshold", + value: "0.5", + }), + ).rejects.toThrow( + /HTTP 400: speakerGate\.threshold is not allowed on this plan/, + ); + }); + + it("fallback path (no definitions) sends booleans and numbers, keeps the exclusive range and R1", async () => { + const response = { + settings: gateSettings({ recheckMaxWindows: 1, recheckOnOther: false }), + defaults: gateSettings(), + }; + listProjectVoiceAdvancedSettings.mockResolvedValue(response); + await runProjectsVoiceAdvancedSet({ + name: "speakerGate.recheckOnOther", + value: "false", + }); + expect(setProjectVoiceAdvancedSetting).toHaveBeenLastCalledWith( + "proj-1", + "speakerGate.recheckOnOther", + false, + ); + await runProjectsVoiceAdvancedSet({ + name: "speakerGate.threshold", + value: "0.6", + }); + expect(setProjectVoiceAdvancedSetting).toHaveBeenLastCalledWith( + "proj-1", + "speakerGate.threshold", + 0.6, + ); + await expect( + runProjectsVoiceAdvancedSet({ + name: "speakerGate.threshold", + value: "1", + }), + ).rejects.toThrow(/engine range/); + await expect( + runProjectsVoiceAdvancedSet({ + name: "speakerGate.splitOnSpeakerChange", + value: "true", + }), + ).rejects.toThrow(/at least 2/); + }); + }); + describe("set against a platform without definitions", () => { const response = { settings: { diff --git a/src/commands/projects/voice-advanced/definitions.ts b/src/commands/projects/voice-advanced/definitions.ts index 2545ae2..2212376 100644 --- a/src/commands/projects/voice-advanced/definitions.ts +++ b/src/commands/projects/voice-advanced/definitions.ts @@ -1,7 +1,11 @@ import { + VOICE_AGENT_CONSTRAINTS, VOICE_AGENT_SETTING_PATHS, VOICE_AGENT_SETTINGS, + checkVoiceAgentConstraints, type VoiceAgentSettingDef, + type VoiceAgentSettingPath, + type VoiceAgentSettingValue, } from "@node-webrtc-rust/voice-catalog"; import type { ProjectVoiceAdvancedSettingsResponse, @@ -27,6 +31,9 @@ export interface ResolvedDef { apiEnum?: readonly string[]; engineMin?: number; engineMax?: number; + /** The engine excludes its min / max (it requires `value > min` / `value < max`). */ + engineExclusiveMin?: boolean; + engineExclusiveMax?: boolean; /** Product cap from the API, applied after the engine range. */ capMin?: number; capMax?: number; @@ -130,6 +137,8 @@ function fromApiDefinition(api: VoiceAdvancedDefinition): ResolvedDef { ...(apiEnum ? { apiEnum } : {}), ...(engine.min !== undefined ? { engineMin: engine.min } : {}), ...(engine.max !== undefined ? { engineMax: engine.max } : {}), + ...(engine.exclusiveMin ? { engineExclusiveMin: true } : {}), + ...(engine.exclusiveMax ? { engineExclusiveMax: true } : {}), ...(api.min !== undefined ? { capMin: api.min } : {}), ...(api.max !== undefined ? { capMax: api.max } : {}), }; @@ -193,6 +202,8 @@ export function fallbackDefinition( ...(engine?.enum ? { engineEnum: engine.enum } : {}), ...(engine?.min !== undefined ? { engineMin: engine.min } : {}), ...(engine?.max !== undefined ? { engineMax: engine.max } : {}), + ...(engine?.exclusiveMin ? { engineExclusiveMin: true } : {}), + ...(engine?.exclusiveMax ? { engineExclusiveMax: true } : {}), }; } @@ -221,12 +232,17 @@ export function parseVoiceAdvancedValue( if (def.integer !== false && !Number.isInteger(n)) { throw new Error(`${key} must be an integer`); } - if ( - (def.engineMin !== undefined && n < def.engineMin) || - (def.engineMax !== undefined && n > def.engineMax) - ) { + const belowMin = + def.engineMin !== undefined && + (def.engineExclusiveMin ? n <= def.engineMin : n < def.engineMin); + const aboveMax = + def.engineMax !== undefined && + (def.engineExclusiveMax ? n >= def.engineMax : n > def.engineMax); + if (belowMin || aboveMax) { + const lo = def.engineExclusiveMin ? "above" : "at least"; + const hi = def.engineExclusiveMax ? "below" : "at most"; throw new Error( - `${key} must be between ${def.engineMin ?? "-inf"} and ${def.engineMax ?? "inf"} (engine range)`, + `${key} must be between ${def.engineMin ?? "-inf"} and ${def.engineMax ?? "inf"} (engine range: ${lo} ${def.engineMin ?? "-inf"}, ${hi} ${def.engineMax ?? "inf"})`, ); } if ( @@ -251,6 +267,49 @@ export function parseVoiceAdvancedValue( return trimmed; } +/** + * The engine's cross-field rules (R1: `recheckMaxWindows` 1 with a recheck on; R2: `checkSpeechMs` + * below `minCheckSpeechMs`) over the project's current settings plus the new value. They apply in + * every `speakerGate.mode`, as in the platform and the runner. Only rules the key takes part in are + * checked, so setting an unrelated key never fails on an older combination. The server stays final. + * Returns the engine's messages. + */ +export function checkConstraintsForSet( + key: string, + value: boolean | number | string, + response: Pick, +): string[] { + const touched = VOICE_AGENT_CONSTRAINTS.filter( + (c) => + c.path === key || + c.gte === key || + (c.when?.anyTrue as readonly string[] | undefined)?.includes(key), + ); + if (touched.length === 0) { + return []; + } + const values: Partial> = + {}; + for (const path of VOICE_AGENT_SETTING_PATHS) { + const parts = path.split("."); + const current = + getValueAtPath(response.settings, parts) ?? + getValueAtPath(response.defaults, parts); + if ( + typeof current === "boolean" || + typeof current === "number" || + typeof current === "string" + ) { + values[path] = current; + } + } + values[key as VoiceAgentSettingPath] = value; + const ids = new Set(touched.map((c) => c.id)); + return checkVoiceAgentConstraints(values) + .filter((f) => ids.has(f.id)) + .map((f) => f.message); +} + function flattenLeaves( value: unknown, prefix: string[], @@ -310,7 +369,9 @@ export function describeRange(def: ResolvedDef): string { return ""; } if (def.type === "number" && min !== undefined && max !== undefined) { - return ` [${min}–${max}]`; + const open = def.capMin === undefined && def.engineExclusiveMin; + const close = def.capMax === undefined && def.engineExclusiveMax; + return ` ${open ? "(" : "["}${min}–${max}${close ? ")" : "]"}`; } const values = def.apiEnum ?? def.engineEnum; return values ? ` [${values.join("|")}]` : ""; @@ -372,5 +433,7 @@ function fromEngine(path: string, def: VoiceAgentSettingDef): ResolvedDef { ...(def.enum ? { engineEnum: def.enum } : {}), ...(def.min !== undefined ? { engineMin: def.min } : {}), ...(def.max !== undefined ? { engineMax: def.max } : {}), + ...(def.exclusiveMin ? { engineExclusiveMin: true } : {}), + ...(def.exclusiveMax ? { engineExclusiveMax: true } : {}), }; } diff --git a/src/commands/projects/voice-advanced/set.ts b/src/commands/projects/voice-advanced/set.ts index ea8a008..9e8f937 100644 --- a/src/commands/projects/voice-advanced/set.ts +++ b/src/commands/projects/voice-advanced/set.ts @@ -3,6 +3,7 @@ import { createApiFromCredentials } from "../../../lib/control-plane-auth.js"; import { requireCredentials } from "../../../lib/config.js"; import { requireProjectId } from "../../../lib/project-config.js"; import { + checkConstraintsForSet, fallbackDefinition, parseVoiceAdvancedValue, resolveDefinitions, @@ -41,6 +42,10 @@ export async function runProjectsVoiceAdvancedSet( } const value = parseVoiceAdvancedValue(def, options.value); + const broken = checkConstraintsForSet(key, value, response); + if (broken.length > 0) { + throw new Error(broken.join("\n")); + } await api.setProjectVoiceAdvancedSetting(projectId, key, value); console.log(`${key}=${String(value)}`); } From bfe9e71aae5f0f22116c89effa412efdcf8a5bc8 Mon Sep 17 00:00:00 2001 From: akirilyuk Date: Tue, 10 Nov 2026 00:19:38 +0700 Subject: [PATCH 2/2] fix(voice-advanced): speaker gate fixture caps match the platform; drop 0 as a recheckMaxWindows value --- README.md | 4 +-- .../projects/voice-advanced/commands.test.ts | 27 ++++++++++++------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index e49eadd..63bf64e 100644 --- a/README.md +++ b/README.md @@ -494,7 +494,7 @@ voicethere projects voice-advanced set vad.adaptive.noiseMarginDb 9 | `speakerGate.suppressShortBargeIn` | bool | `false` | | `speakerGate.splitOnSpeakerChange` | bool | `false` | | `speakerGate.recheckOnOther` | bool | `true` | -| `speakerGate.recheckMaxWindows` | whole number, 0 = no cap | `12` | +| `speakerGate.recheckMaxWindows` | whole number (platform: 1–24) | `12` | | `speakerGate.threshold` | above 0 and below 1 | `0.459` | | `speakerGate.enrollSpeechMs` | whole number (ms) | `3000` | | `speakerGate.checkSpeechMs` | whole number (ms) | `1500` | @@ -506,7 +506,7 @@ voicethere projects voice-advanced set vad.adaptive.noiseMarginDb 9 The platform may cap the speaker gate numbers below the engine range; `list` shows the range that applies. Two rules hold in every `speakerGate.mode`, and `set` checks them before it sends anything (the server still has the final say): -- `speakerGate.recheckMaxWindows` must not be `1` while `speakerGate.recheckOnOther` or `speakerGate.splitOnSpeakerChange` is `true`. Use `0` (no cap), `2` or more, or turn both off first. +- `speakerGate.recheckMaxWindows` must not be `1` while `speakerGate.recheckOnOther` or `speakerGate.splitOnSpeakerChange` is `true`. Use `2` or more, or turn both off first. - `speakerGate.checkSpeechMs` must be at least `speakerGate.minCheckSpeechMs`. `speakerGate.splitOnSpeakerChange` ends an utterance when the caller's speech runs straight into another voice, so the caller's text does not carry the other person's words. diff --git a/src/commands/projects/voice-advanced/commands.test.ts b/src/commands/projects/voice-advanced/commands.test.ts index f2ddd86..c52adde 100644 --- a/src/commands/projects/voice-advanced/commands.test.ts +++ b/src/commands/projects/voice-advanced/commands.test.ts @@ -112,8 +112,8 @@ const DEFINITIONS: VoiceAdvancedDefinition[] = [ key: "speakerGate.recheckMaxWindows", type: "number", default: 12, - min: 0, - max: 50, + min: 1, + max: 24, engineKey: "speakerGate.recheckMaxWindows", }), def({ @@ -121,7 +121,7 @@ const DEFINITIONS: VoiceAdvancedDefinition[] = [ type: "number", default: 0.459, integer: false, - min: 0.1, + min: 0.2, max: 0.8, engineKey: "speakerGate.threshold", }), @@ -129,7 +129,7 @@ const DEFINITIONS: VoiceAdvancedDefinition[] = [ key: "speakerGate.enrollSpeechMs", type: "number", default: 3000, - min: 1000, + min: 1500, max: 10000, engineKey: "speakerGate.enrollSpeechMs", }), @@ -137,7 +137,7 @@ const DEFINITIONS: VoiceAdvancedDefinition[] = [ key: "speakerGate.checkSpeechMs", type: "number", default: 1500, - min: 500, + min: 1000, max: 5000, engineKey: "speakerGate.checkSpeechMs", }), @@ -145,7 +145,7 @@ const DEFINITIONS: VoiceAdvancedDefinition[] = [ key: "speakerGate.minCheckSpeechMs", type: "number", default: 1500, - min: 500, + min: 1000, max: 5000, engineKey: "speakerGate.minCheckSpeechMs", }), @@ -341,7 +341,7 @@ describe("projects voice-advanced", () => { expect(lines.some((l) => l.startsWith(`speakerGate.${k}=`))).toBe(true); } expect(lines).toContain( - "speakerGate.threshold=0.459 (default 0.459 [0.1–0.8])", + "speakerGate.threshold=0.459 (default 0.459 [0.2–0.8])", ); }); @@ -367,7 +367,7 @@ describe("projects voice-advanced", () => { name: "speakerGate.threshold", value: "0.85", }), - ).rejects.toThrow(/between 0\.1 and 0\.8$/); + ).rejects.toThrow(/between 0\.2 and 0\.8$/); expect(setProjectVoiceAdvancedSetting).not.toHaveBeenCalled(); await runProjectsVoiceAdvancedSet({ name: "speakerGate.threshold", @@ -408,7 +408,7 @@ describe("projects voice-advanced", () => { expect(setProjectVoiceAdvancedSetting).not.toHaveBeenCalled(); }); - it("R1 allows 1 window once both rechecks are off, and 0 with the split on", async () => { + it("R1 allows 1 window once both rechecks are off, and 2 with the split on", async () => { listProjectVoiceAdvancedSettings.mockResolvedValue({ settings: gateSettings({ recheckOnOther: false, @@ -427,9 +427,16 @@ describe("projects voice-advanced", () => { }); await runProjectsVoiceAdvancedSet({ name: "speakerGate.recheckMaxWindows", - value: "0", + value: "2", }); expect(setProjectVoiceAdvancedSetting).toHaveBeenCalledTimes(2); + await expect( + runProjectsVoiceAdvancedSet({ + name: "speakerGate.recheckMaxWindows", + value: "0", + }), + ).rejects.toThrow(/between 1 and 24/); + expect(setProjectVoiceAdvancedSetting).toHaveBeenCalledTimes(2); }); it("R2: checkSpeechMs below minCheckSpeechMs is rejected, equal passes", async () => {