From b26ed1920572deb3e595ea7ae41631316e85766c Mon Sep 17 00:00:00 2001 From: Shaw Walters Date: Fri, 4 Dec 2026 14:10:28 -0800 Subject: [PATCH] Let the owner's words interrupt Alpha however loud the phone hears them On the Pixel's own recognizer the owner's words over Alpha were heard at -40 to -46 dBFS, below the -38 dBFS a near voice had to reach, so barge-in never fired; a television's words fell in the same band, so no loudness separates them. The level gate, its loud-room tracker and the level plumbing go; echo, filler, stray-word and no-word rules stay. --- apps/app/src/platform/spokenReference.ts | 7 +- apps/app/src/platform/voice.vibe | 53 +++-------- apps/app/src/platform/voiceLevel.ts | 112 ----------------------- apps/app/test/voice-barge-in.test.tsx | 15 ++- apps/app/test/voice-loud-room.test.tsx | 68 +------------- apps/app/test/voice.test.tsx | 12 +-- spec/app/voice/index.md | 84 ++++++++--------- 7 files changed, 74 insertions(+), 277 deletions(-) delete mode 100644 apps/app/src/platform/voiceLevel.ts diff --git a/apps/app/src/platform/spokenReference.ts b/apps/app/src/platform/spokenReference.ts index cd02d3125a..3696c259ed 100644 --- a/apps/app/src/platform/spokenReference.ts +++ b/apps/app/src/platform/spokenReference.ts @@ -1,4 +1,4 @@ -// spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words, a voice far from the phone, or Alpha's own voice never does" +// spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words or Alpha's own voice never does" import { type Hearing, interruptWords } from "../../gen/app__voice.ts" import { isFillerWord, spokenWordsOf } from "@elizaos/agent" @@ -183,10 +183,10 @@ export class SpokenReference { /** * What `heard` holds for the spec's `heardOf` to class: its words and fillers, without sound tags, its first two words - * besides fillers, whether they are Alpha's echo, and how loud they were. In a segment the owner's words have claimed, + * besides fillers, and whether they are Alpha's echo. In a segment the owner's words have claimed, * nothing is weighed as echo, but it is still heard near Alpha's voice. @throws {never} */ - hearing(heard: string, at: { readonly overAlpha: boolean; readonly duringAlpha: boolean; readonly claimed: boolean; readonly partial: boolean; readonly levelDb: number | undefined }): Hearing { + hearing(heard: string, at: { readonly overAlpha: boolean; readonly duringAlpha: boolean; readonly claimed: boolean; readonly partial: boolean }): Hearing { const words = spokenWordsOf(heard) const said = words.filter((word) => !isFillerWord(word)) return { @@ -197,7 +197,6 @@ export class SpokenReference { echo: at.overAlpha && !at.claimed && this.echoes(words.join(" "), at.partial), overAlpha: at.overAlpha, duringAlpha: at.duringAlpha, - levelDb: Math.round(at.levelDb ?? 0), } } diff --git a/apps/app/src/platform/voice.vibe b/apps/app/src/platform/voice.vibe index 6e51689743..7e9a10f9c7 100644 --- a/apps/app/src/platform/voice.vibe +++ b/apps/app/src/platform/voice.vibe @@ -10,7 +10,6 @@ import { pageMicrophone, pageSpeechBase, pageSpeechRelay } from "./pageSpeech.ts import { readInProcessSharedPreference } from "./sharedStore.vibe" import { SpokenReference, localSpeechLastsMs, nowMs } from "./spokenReference.ts" import { TurnGap } from "./turnGap.ts" -import { VoiceLevelTracker } from "./voiceLevel.ts" export type VoiceGrant = "granted" | "denied" | "prompt" | "unknown" @@ -43,7 +42,6 @@ interface LiveCapture { readonly session: number readonly captureId: string readonly preview: VoicePreview | undefined - readonly levels: VoiceLevelTracker stopPreview: (() => void) | undefined phase: "Opening" | "Listening" | "Draining" | "Cancelling" | "Retired" requested: boolean @@ -74,10 +72,10 @@ type RecordingStop = typeof recordingStop.Type const recognitionTurn = Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(128)) const recognitionText = Schema.String.check(Schema.isMaxLength(65_536)) -/** What the phone's recognizer heard of a segment: the words so far over a playing reply, or the segment's final words, each with the level it measured where it did. */ +/** What the phone's recognizer heard of a segment: the words so far over a playing reply, or the segment's final words. */ const heardText = Schema.Union([ - Schema.Struct({ soFar: Schema.Struct({ turnId: recognitionTurn, text: recognitionText, heardMs: Schema.Number, levelDbfs: Schema.Number }) }), - Schema.Struct({ final: Schema.Struct({ turnId: Schema.optionalKey(recognitionTurn), text: recognitionText, levelDbfs: Schema.optionalKey(Schema.Number) }) }), + Schema.Struct({ soFar: Schema.Struct({ turnId: recognitionTurn, text: recognitionText, heardMs: Schema.Number }) }), + Schema.Struct({ final: Schema.Struct({ turnId: Schema.optionalKey(recognitionTurn), text: recognitionText }) }), ]) /** How long a segment must sound over a playing reply before the phone asks its recognizer what has been heard so far: nine voice windows. */ @@ -411,10 +409,10 @@ effect function hearNativePreview(capture: LiveCapture, current: () => boolean, if (capture.phase !== "Listening" || words.seq <= turn.sequence) return const overAlpha = capture.nearAlpha || reference.near(nowMs()) const shown = reference.hearing(words.text, { - overAlpha, duringAlpha: capture.duringAlpha || reference.speaking, claimed: capture.claimed === words.turnId, partial: true, levelDb: capture.levels.effectiveLevelDb(), + overAlpha, duringAlpha: capture.duringAlpha || reference.speaking, claimed: capture.claimed === words.turnId, partial: true, }) const heard = heardOf(shown) - if (!makesATurn(heard) || (heard === "Distant" && overAlpha)) return + if (!makesATurn(heard)) return turn.sequence = words.seq preview.show(words.text) })) @@ -462,9 +460,7 @@ function makeNativeEvents( if (Option.isSome(stopped)) stoppedRecording(stopped.value) })), () => undefined), register("liveCaptureFrames", (data, live) => { - if (typeof data.peak === "number") live.levels.observe(data.peak, reference.speaking) if (Array.isArray(data.vad) && data.vad.some((edge) => asRecord(edge)?.type === "speech-start")) { - live.levels.startUtterance() live.nearAlpha = reference.near(nowMs()) live.duringAlpha = reference.speaking if (!live.nearAlpha) return [{ kind: "speechStart", session: live.session }] @@ -475,21 +471,19 @@ function makeNativeEvents( const { session } = live const failure = asString(data.error) if (failure !== "") { - live.levels.endUtterance() retireNativePreview(live) return [{ kind: "ended", session, reason: failure, fault: "NotTheNetwork", waitMs: 0 }] } const decoded = Schema.decodeUnknownOption(heardText)(data) if (Option.isNone(decoded)) return [] - // spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words, a voice far from the phone, or Alpha's own voice never does" + // spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words or Alpha's own voice never does" const soFar = "soFar" in decoded.value if (soFar) live.duringAlpha = true const heard = "soFar" in decoded.value ? decoded.value.soFar : decoded.value.final const owners = heard.turnId !== undefined && live.claimed === heard.turnId const text = (owners && !soFar ? reference.ownerPart(heard.text) : heard.text).trim() const overAlpha = soFar || live.nearAlpha || reference.nearFinal(nowMs()) - const levelDb = live.levels.adjustLevelDb(heard.levelDbfs) - const kind = heardOf(reference.hearing(text, { overAlpha, duringAlpha: live.duringAlpha || reference.speaking, claimed: owners, partial: soFar, levelDb })) + const kind = heardOf(reference.hearing(text, { overAlpha, duringAlpha: live.duringAlpha || reference.speaking, claimed: owners, partial: soFar })) const interrupting: VoiceEvent = { kind: "bargeIn", session, heard: kind } if (soFar) { if (kind === "Words") live.claimed = heard.turnId @@ -498,14 +492,12 @@ function makeNativeEvents( live.nearAlpha = false live.duringAlpha = false live.claimed = undefined - live.levels.endUtterance() - if (!makesATurn(kind) || (kind === "Distant" && reference.speaking)) { + if (!makesATurn(kind)) { live.preview?.clear() const empty: VoiceEvent = { kind: "speechEnd", session, text: "" } return kind === "Filler" ? [interrupting, empty] : [empty] } - if (kind === "Distant") live.preview?.clear() - else retireNativePreview(live) + retireNativePreview(live) return [interrupting, { kind: "speechStart", session }, { kind: "speechEnd", session, text }] }, true), register("liveCaptureEnded", (data, live) => { @@ -902,8 +894,6 @@ interface CloudVoiceSession { capture: Awaited> | undefined /** Relay sessions this conversation asked to start that the relay has not refused: while there are none, nothing of it can listen or speak. */ relayStarts: number - /** Rolling microphone loudness and ambient noise floor for loud-room gating. */ - readonly levels: VoiceLevelTracker /** The utterance the current capture is hearing, sent once the relay's final is followed by the long gap. */ gap: TurnGap | undefined /** Whether the relay's capture cancels Alpha's own voice out of what it hears. */ @@ -1030,7 +1020,6 @@ function cloudMicController(config: CloudMicConfig) { const owner: CloudVoiceSession = existing?.session === session && !existing.failed ? existing : { session, abort: makeAbort(), - levels: new VoiceLevelTracker(), capture: undefined, relayStarts: 0, gap: undefined, @@ -1046,9 +1035,8 @@ function cloudMicController(config: CloudMicConfig) { assertCurrent: makeSessionGuard(config.currentSession, session), onInterim: (text) => { if (config.currentSession() !== session) return - const overAlpha = owner.nearAlpha || config.reference.near(nowMs()) const heard = tellOwnerWords(owner, text, true) - if (!makesATurn(heard) || (heard === "Distant" && overAlpha)) return + if (!makesATurn(heard)) return const current = config.getPreview() if (current?.session !== session) return current.outlet?.show(owner.gap?.joined(text) ?? text) @@ -1081,12 +1069,8 @@ function cloudMicController(config: CloudMicConfig) { tryPromise({ try: () => owner.stream.listen({ signal: owner.abort.signal, - onLevel: (peak) => { - owner.levels.observe(peak, config.reference.speaking) - }, onSpeechStart: () => { gap.speechStarted() - owner.levels.startUtterance() owner.nearAlpha = config.reference.near(nowMs()) owner.duringAlpha = config.reference.speaking owner.told = false @@ -1095,11 +1079,9 @@ function cloudMicController(config: CloudMicConfig) { }, onSpeechEnd: () => undefined, onSegment: (text) => { - const overAlpha = owner.nearAlpha || config.reference.near(nowMs()) const said = text !== null && owner.claimed ? config.reference.ownerPart(text) : text const heard = said === null ? "NoWords" : tellOwnerWords(owner, said, false) - owner.levels.endUtterance() - if (heard === "Echo" || (heard === "Distant" && (overAlpha || config.reference.speaking))) { + if (heard === "Echo") { gap.segment(null) owner.nearAlpha = config.reference.near(nowMs()) owner.duringAlpha = config.reference.speaking @@ -1156,7 +1138,7 @@ function cloudMicController(config: CloudMicConfig) { owner.told = true config.publish({ kind: "speechStart", session: owner.session }) } - // spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words, a voice far from the phone, or Alpha's own voice never does": words that began while Alpha spoke, or a moment after, and are mostly Alpha's own are its echo, until the owner's words have interrupted it; relay loudness adapts above the room's rolling ambient floor. + // spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words or Alpha's own voice never does": words that began while Alpha spoke, or a moment after, and are mostly Alpha's own are its echo, until the owner's words have interrupted it. const tellOwnerWords = (owner: CloudVoiceSession, text: string, partial: boolean): Heard => { const overAlpha = owner.nearAlpha || config.reference.near(nowMs()) const duringAlpha = owner.duringAlpha || config.reference.speaking @@ -1165,12 +1147,11 @@ function cloudMicController(config: CloudMicConfig) { duringAlpha, claimed: owner.claimed, partial, - levelDb: owner.levels.effectiveLevelDb(), })) if (config.currentSession() !== owner.session) return heard if (heard === "Words") owner.claimed = owner.claimed || overAlpha if (heard === "Words" || heard === "Filler") config.publish({ kind: "bargeIn", session: owner.session, heard }) - if (heard === "Words" || (heard === "Distant" && !overAlpha)) tellSpeech(owner) + if (heard === "Words") tellSpeech(owner) return heard } return { clearPreview, listen } @@ -1446,7 +1427,6 @@ function phoneNativeCapture( reference: SpokenReference, ) { let nativeCapture: LiveCapture | undefined - let sessionLevels: { readonly session: number; readonly tracker: VoiceLevelTracker } | undefined effect function stopCapture(capture: LiveCapture, discard: boolean): void!VoiceBridgeFailed { const opening = capture.phase === "Opening" || capture.phase === "Cancelling" @@ -1491,11 +1471,8 @@ function phoneNativeCapture( } if (readActiveSession() !== session) throw new VoiceBridgeFailed({ method: "startLiveCapture", cause: "session-changed" }) if (nativeCapture !== undefined) retireNativePreview(nativeCapture) - const levels = sessionLevels?.session === session ? sessionLevels.tracker : new VoiceLevelTracker() - levels.endUtterance() - sessionLevels = { session, tracker: levels } const capture: LiveCapture = { - session, captureId: fresh(), preview, levels, stopPreview: undefined, phase: "Opening", + session, captureId: fresh(), preview, stopPreview: undefined, phase: "Opening", requested: false, openingStop: undefined, echoCancelled: false, nearAlpha: false, duringAlpha: false, claimed: undefined, } nativeCapture = capture @@ -1539,7 +1516,6 @@ function phoneNativeCapture( } function retire(): void { - sessionLevels = undefined if (nativeCapture === undefined) return if (nativeCapture.phase === "Opening") nativeCapture.phase = "Cancelling" else if (nativeCapture.phase === "Listening" || nativeCapture.phase === "Draining") nativeCapture.phase = "Retired" @@ -1605,7 +1581,6 @@ function abortCloudSession(owner: CloudVoiceSession): void { // spec/app/voice/index.md, "When the owner finishes speaking, the microphone closes, and only then is the turn sent, once and automatically": Stop drops words still waiting on the gap, as v119's stop did (voice-assistant-session.ts:574-575). owner.gap?.cancel() owner.gap = undefined - owner.levels.clear() owner.abort.abort() } diff --git a/apps/app/src/platform/voiceLevel.ts b/apps/app/src/platform/voiceLevel.ts deleted file mode 100644 index e263120153..0000000000 --- a/apps/app/src/platform/voiceLevel.ts +++ /dev/null @@ -1,112 +0,0 @@ -// spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words, a voice far from the phone, or Alpha's own voice never does" - -/** Floor in dBFS for silence or non-finite linear levels. */ -export const LEVEL_FLOOR_DBFS = -120 - -/** Minimum near-field RMS-equivalent level in dBFS expected from the owner speaking to the phone. */ -export const NEAR_FIELD_DBFS = -38 - -/** Minimum SNR margin in dB above the rolling ambient room noise floor to count as near-field over Alpha. */ -export const LOUD_ROOM_SNR_MARGIN_DB = 8 - -const PEAK_TO_RMS_OFFSET_DB = 6 -const AMBIENT_WINDOW_SIZE = 60 -const AMBIENT_MIN_SAMPLES = 4 -const AMBIENT_PERCENTILE = 0.2 -const RECENT_PREROLL_SAMPLES = 6 -const UTTERANCE_MAX_SAMPLES = 120 -const UTTERANCE_PERCENTILE = 0.9 - -/** Convert a normalized linear peak amplitude (`0..1`) to RMS-equivalent dBFS. @throws {never} */ -export function peakToDbfs(peak: number): number { - if (!Number.isFinite(peak) || peak <= 0) return LEVEL_FLOOR_DBFS - const clamped = Math.min(1, peak) - return Math.max(LEVEL_FLOOR_DBFS, Math.round((20 * Math.log10(clamped) - PEAK_TO_RMS_OFFSET_DB) * 2) / 2) -} - -function percentile(values: readonly number[], fraction: number): number { - const sorted = [...values].sort((a, b) => a - b) - return sorted[Math.max(0, Math.min(sorted.length - 1, Math.ceil(sorted.length * fraction) - 1))] ?? LEVEL_FLOOR_DBFS -} - -/** - * Tracks live microphone loudness in dBFS and a rolling ambient noise floor so distant voices and loud-room - * background chatter stay below `NEAR_FIELD_DBFS` after ambient adjustment. - */ -export class VoiceLevelTracker { - #ambient: number[] = [] - #recent: number[] = [] - #utterance: number[] = [] - #inUtterance = false - - /** Observe one normalized linear peak (`0..1`) from the microphone. @throws {never} */ - observe(peak: number, alphaSpeaking: boolean): void { - const db = peakToDbfs(peak) - this.#recent.push(db) - if (this.#recent.length > RECENT_PREROLL_SAMPLES) this.#recent.shift() - if (this.#inUtterance) { - this.#utterance.push(db) - if (this.#utterance.length > UTTERANCE_MAX_SAMPLES) this.#utterance.shift() - } - if (!alphaSpeaking) { - this.#ambient.push(db) - if (this.#ambient.length > AMBIENT_WINDOW_SIZE) this.#ambient.shift() - } - } - - /** Begin tracking the loudness of a new spoken utterance, seeding with recent pre-roll frames. @throws {never} */ - startUtterance(): void { - this.#inUtterance = true - this.#utterance = [...this.#recent] - } - - /** Finish the current utterance window while keeping the rolling ambient noise floor. @throws {never} */ - endUtterance(): void { - this.#inUtterance = false - this.#utterance = [] - } - - /** Reset all state when a Talk session shuts down. @throws {never} */ - clear(): void { - this.#ambient = [] - this.#recent = [] - this.#utterance = [] - this.#inUtterance = false - } - - /** Rolling ambient noise floor in dBFS once enough baseline frames have been observed. */ - get noiseFloorDbfs(): number | undefined { - if (this.#ambient.length < AMBIENT_MIN_SAMPLES) return undefined - return percentile(this.#ambient, AMBIENT_PERCENTILE) - } - - /** 90th-percentile loudness in dBFS of the current utterance, or undefined when no level frames arrived. */ - get utteranceDbfs(): number | undefined { - const sample = this.#utterance.length > 0 ? this.#utterance : this.#recent - if (sample.length === 0) return undefined - return percentile(sample, UTTERANCE_PERCENTILE) - } - - /** Effective near-field threshold in dBFS, adapting upward in loud rooms by `LOUD_ROOM_SNR_MARGIN_DB`. @throws {never} */ - thresholdDbfs(): number { - const floor = this.noiseFloorDbfs - return floor === undefined ? NEAR_FIELD_DBFS : Math.max(NEAR_FIELD_DBFS, floor + LOUD_ROOM_SNR_MARGIN_DB) - } - - /** - * Shift a measured level in dBFS (or the current utterance level when omitted) down by any excess loud-room - * threshold above `NEAR_FIELD_DBFS`, so callers comparing against `nearFieldDb` enforce `LOUD_ROOM_SNR_MARGIN_DB`. - * Returns `undefined` when no loudness measurement is available. @throws {never} - */ - adjustLevelDb(measuredDb: number | undefined): number | undefined { - const base = measuredDb !== undefined && Number.isFinite(measuredDb) ? measuredDb : this.utteranceDbfs - if (base === undefined || !Number.isFinite(base)) return undefined - const excess = Math.max(0, this.thresholdDbfs() - NEAR_FIELD_DBFS) - return Math.max(LEVEL_FLOOR_DBFS, Math.round((base - excess) * 2) / 2) - } - - /** Ambient-adjusted loudness in dBFS of the current utterance, or `undefined` when no level frames arrived. @throws {never} */ - effectiveLevelDb(): number | undefined { - return this.adjustLevelDb(undefined) - } -} diff --git a/apps/app/test/voice-barge-in.test.tsx b/apps/app/test/voice-barge-in.test.tsx index 2844c37580..da364e123f 100644 --- a/apps/app/test/voice-barge-in.test.tsx +++ b/apps/app/test/voice-barge-in.test.tsx @@ -1,5 +1,5 @@ // @vitest-environment happy-dom -// spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words, a voice far from the phone, or Alpha's own voice never does" +// spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words or Alpha's own voice never does" import { Effect } from "effect"; import { afterEach, describe, expect, it, vi } from "vitest"; import { Machine as Conversation } from "../gen/app__assistant.effect.vibe"; @@ -102,7 +102,7 @@ describe("Talk on the phone's own recognizer (spec/app/voice/index.md, \"Story: await until(alpha, area, Voice.Machine, (s) => s.phase === "Speaking" && s.mic === "On" && s.queued > 0); const hushed = world.voice.hushCalls; - // spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words, a voice far from the phone, or Alpha's own voice never does": the recognizer hears the owner's words over Alpha (45f6bed30 prototype/voice-adapter.ts:885-889), and Alpha stops speaking at once. + // spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words or Alpha's own voice never does": the recognizer hears the owner's words over Alpha (45f6bed30 prototype/voice-adapter.ts:885-889), and Alpha stops speaking at once. hear.soFar("wait"); await until(alpha, area, Voice.Machine, (s) => s.phase === "Listening" && s.mic === "On" && s.heard); expect(world.voice.hushCalls).toBeGreaterThan(hushed); @@ -114,7 +114,7 @@ describe("Talk on the phone's own recognizer (spec/app/voice/index.md, \"Story: }); }); -describe("Only the owner's words interrupt Alpha (spec/app/voice/index.md, \"Only the owner's words interrupt Alpha, thinking or speaking; a sound without words, a voice far from the phone, or Alpha's own voice never does\")", () => { +describe("Only the owner's words interrupt Alpha (spec/app/voice/index.md, \"Only the owner's words interrupt Alpha, thinking or speaking; a sound without words or Alpha's own voice never does\")", () => { it("never stops Alpha for a sound without words or one or two stray words, and the reply ends by itself", async () => { const talk = await speaking(); const { hear } = talk; @@ -201,11 +201,8 @@ describe("Only the owner's words interrupt Alpha (spec/app/voice/index.md, \"Onl expect([world.ask.said, world.voice.spoken.map((one) => one.text)]).toEqual([["Tell me a story", "Actually, what time is it"], ["It is noon."]]); }); - it("does not stop Alpha for words heard far from the phone", async () => { - const { world, hear, settle, voice, hushed } = await speaking(); - hear.soFar("and now the weather", { turnId: "television", levelDbfs: -55 }); - hear.final("And now the weather.", { turnId: "television", levelDbfs: -55 }); - await settle(); - expect([(await voice()).phase, world.voice.hushCalls - hushed, world.ask.said]).toEqual(["Speaking", 0, ["Tell me a story"]]); + it("stops Alpha for the owner's words over it however quietly the phone hears them, as the Pixel heard \"Wait, what time is it?\" at -46 dBFS", async () => { + const talk = await speaking(); + await expectInterruptedAndSent(talk, "wait what time", "Wait, what time is it?", "Wait, what time is it?", { turnId: "owner", levelDbfs: -46 }); }); }); diff --git a/apps/app/test/voice-loud-room.test.tsx b/apps/app/test/voice-loud-room.test.tsx index 11d866a580..c6f8a3acf8 100644 --- a/apps/app/test/voice-loud-room.test.tsx +++ b/apps/app/test/voice-loud-room.test.tsx @@ -1,5 +1,5 @@ // @vitest-environment happy-dom -// spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words, a voice far from the phone, or Alpha's own voice never does"; spec/app/voice/index.md, "When the owner finishes speaking, the microphone closes, and only then is the turn sent, once and automatically"; spec/app/voice/index.md, "Stop while the owner is speaking still sends what they said, Alpha answers it, and then Talk ends" +// spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words or Alpha's own voice never does"; spec/app/voice/index.md, "When the owner finishes speaking, the microphone closes, and only then is the turn sent, once and automatically"; spec/app/voice/index.md, "Stop while the owner is speaking still sends what they said, Alpha answers it, and then Talk ends" import { Effect, Fiber, Layer, ManagedRuntime, Stream } from "effect"; import { afterEach, describe, expect, it } from "vitest"; import { Machine as Conversation } from "../gen/app__assistant.effect.vibe"; @@ -8,7 +8,6 @@ import type { Mount } from "../src/areas.ts"; import assistant from "../src/assistant/index.tsx"; import { CLOUD_TURN_GAP_MS } from "../src/platform/turnGap.ts"; import { phoneVoiceBridge, type VoiceEvent, type VoicePreview, VoiceBridge } from "../src/platform/voice.vibe"; -import { LEVEL_FLOOR_DBFS, LOUD_ROOM_SNR_MARGIN_DB, NEAR_FIELD_DBFS, peakToDbfs, VoiceLevelTracker } from "../src/platform/voiceLevel.ts"; import { closeAll, later, open, press, underAct, until } from "./alpha.tsx"; import { scene, type Scene } from "./fakes/scene.ts"; import { fakeWorld } from "./fakes/world.vibe"; @@ -117,63 +116,12 @@ async function withPhoneBridge(world: Scene, run: (bridge: { } } -describe("VoiceLevelTracker loud-room loudness gating", () => { - it("converts linear frame peaks to RMS-equivalent dBFS with a safe silence floor", () => { - expect(peakToDbfs(0)).toBe(LEVEL_FLOOR_DBFS); - expect(peakToDbfs(-0.2)).toBe(LEVEL_FLOOR_DBFS); - expect(peakToDbfs(Number.NaN)).toBe(LEVEL_FLOOR_DBFS); - expect(peakToDbfs(1)).toBe(-6); - expect(peakToDbfs(0.01)).toBe(-46); - expect(peakToDbfs(0.25)).toBe(-18); - }); - - it("adapts effective loudness below NEAR_FIELD_DBFS in loud rooms without inflating baseline during Alpha playback", () => { - const quiet = new VoiceLevelTracker(); - expect(quiet.effectiveLevelDb()).toBeUndefined(); - expect(quiet.thresholdDbfs()).toBe(NEAR_FIELD_DBFS); - - for (let i = 0; i < 6; i += 1) quiet.observe(0.002, false); - expect(quiet.thresholdDbfs()).toBe(NEAR_FIELD_DBFS); - quiet.startUtterance(); - quiet.observe(0.008, true); - expect(quiet.effectiveLevelDb()).toBeLessThan(NEAR_FIELD_DBFS); - expect(quiet.adjustLevelDb(-20)).toBe(-20); - quiet.endUtterance(); - - for (let i = 0; i < 12; i += 1) quiet.observe(0.6, true); - expect(quiet.thresholdDbfs()).toBe(NEAR_FIELD_DBFS); - - const cafe = new VoiceLevelTracker(); - for (let i = 0; i < 8; i += 1) cafe.observe(0.1, false); - expect(cafe.noiseFloorDbfs).toBe(-26); - expect(cafe.thresholdDbfs()).toBe(-26 + LOUD_ROOM_SNR_MARGIN_DB); - - cafe.startUtterance(); - for (let i = 0; i < 4; i += 1) cafe.observe(0.14, true); - expect(cafe.effectiveLevelDb()).toBeLessThan(NEAR_FIELD_DBFS); - expect(cafe.adjustLevelDb(-23)).toBeLessThan(NEAR_FIELD_DBFS); - expect(cafe.adjustLevelDb(-14)).toBeGreaterThanOrEqual(NEAR_FIELD_DBFS); - cafe.endUtterance(); - - cafe.observe(0.4, true); - cafe.observe(0.4, true); - cafe.startUtterance(); - cafe.observe(0.08, true); - expect(cafe.effectiveLevelDb()).toBeGreaterThanOrEqual(NEAR_FIELD_DBFS); - }); -}); - describe("Loud-room voice protection over Cloud Talk", () => { - it("ignores loud-room chatter and sound tags over Alpha while admitting near-field owner barge-in", async () => { + it("ignores sound tags over Alpha in a loud room while admitting the owner's barge-in", async () => { const { world, alpha, area, sessionId, playing } = await startCloudSession("Once there was a lighthouse on a rocky coast.", { ambientPeak: 0.1 }); await until(alpha, area, Voice.Machine, (s) => s.phase === "Speaking" && s.mic === "On" && s.duplex); const hushed = world.voice.hushCalls; - await emitIgnoredCloudSpeech(world, alpha, area, sessionId, hushed, { - peak: 0.14, - interim: "pass the coffee please", - final: "Pass the coffee please", - }); await emitIgnoredCloudSpeech(world, alpha, area, sessionId, hushed, { peak: 0.5, interim: "[Music]", @@ -211,7 +159,7 @@ describe("Loud-room voice protection over Cloud Talk", () => { }); describe("Loud-room voice protection, preview safety, and draining over Local Talk", () => { - it("adapts native barge-in above a loud ambient floor and keeps Stop-to-send and Mute clean", async () => { + it("admits native barge-in in a loud room and keeps Stop-to-send and Mute clean", async () => { const { world, alpha, area } = await openTalk({ signedIn: false, reply: "Rain starts at six.", holdAfterTools: true }); const captureId = world.voice.activeMicSession; emitLocalLevels(world, captureId, 0.1, 8); @@ -226,12 +174,6 @@ describe("Loud-room voice protection, preview safety, and draining over Local Ta const reopenedCaptureId = world.voice.activeMicSession; const hushed = world.voice.hushCalls; - emitLocalLevels(world, reopenedCaptureId, 0.14, 6, true); - world.voice.hearSoFar?.("pass the coffee please", { turnId: "t3", levelDbfs: -23 }); - world.voice.hearFinal?.("Pass the coffee please", { turnId: "t3", levelDbfs: -23 }); - await later(alpha, 50); - expect([(await voiceState(area)).phase, world.voice.hushCalls, world.ask.said]).toEqual(["Speaking", hushed, ["Check the weather"]]); - emitLocalLevels(world, reopenedCaptureId, 0.45, 4, true); world.voice.hearSoFar?.("wait what time", { turnId: "t4", levelDbfs: -14 }); await until(alpha, area, Voice.Machine, ({ heard, mic, phase }) => heard && mic === "On" && phase === "Listening"); @@ -245,7 +187,7 @@ describe("Loud-room voice protection, preview safety, and draining over Local Ta expect(world.ask.said).toEqual(["Check the weather", "Wait what time is it"]); }); - it("keeps native live preview alive through a Distant final while Thinking and drains closeMic(keep=true)", async () => { + it("keeps native live preview alive through a final without words while Thinking and drains closeMic(keep=true)", async () => { const previewWorld = { ...scene(), phone: true, signedIn: false }; let cleared = 0; let retired = false; @@ -261,7 +203,7 @@ describe("Loud-room voice protection, preview safety, and draining over Local Ta }; await withPhoneBridge(previewWorld, async (bridge) => { await bridge.openMic(1, preview); - previewWorld.voice.hearFinal?.("someone across the room", { turnId: "distant-thinking", levelDbfs: -55 }); + previewWorld.voice.hearFinal?.("[Music]", { turnId: "sound-thinking" }); expect([cleared, retired]).toEqual([1, false]); previewWorld.voice.hearFinal?.("What time is it", { turnId: "owner-turn", levelDbfs: -20 }); expect(retired).toBe(true); diff --git a/apps/app/test/voice.test.tsx b/apps/app/test/voice.test.tsx index e41887e1bc..3da0872b46 100644 --- a/apps/app/test/voice.test.tsx +++ b/apps/app/test/voice.test.tsx @@ -527,7 +527,7 @@ describe("Voice Bug 1 & Bug 3 journeys", () => { return { world, runtime, relay, playing, hushed: world.voice.hushCalls }; } - // spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words, a voice far from the phone, or Alpha's own voice never does"; spec/app/voice/index.md, "Alpha's reply is spoken a sentence at a time, sentences streamed before the reply is complete included, and only for the current turn" + // spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words or Alpha's own voice never does"; spec/app/voice/index.md, "Alpha's reply is spoken a sentence at a time, sentences streamed before the reply is complete included, and only for the current turn" it("over the Cloud relay, hushes Alpha once the owner's words are heard over its reply and sends them as the next turn, and never takes Alpha's own words for the owner's", async () => { const { world, runtime, relay, playing, hushed } = await beginCloudSpeaking("Tell me a story", "Once there was a lighthouse. What I know is that it stood on a quiet shore."); @@ -541,7 +541,7 @@ describe("Voice Bug 1 & Bug 3 journeys", () => { world.voice.emitCloud?.({ type: "transcript", sessionId: relay, text: "once there was a lighthouse", final: false }); await expectIgnoredOverAlpha("Once there was a lighthouse."); - // spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words, a voice far from the phone, or Alpha's own voice never does": an empty transcript, a sound tag or one stray word heard so far over Alpha never hushes it, as an empty one did on the owner's Pixel, and a stray word heard just before the owner's words is never joined to their turn. + // spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words or Alpha's own voice never does": an empty transcript, a sound tag or one stray word heard so far over Alpha never hushes it, as an empty one did on the owner's Pixel, and a stray word heard just before the owner's words is never joined to their turn. world.voice.emitCloud?.({ type: "speech-start", sessionId: relay }); for (const heard of ["", "[Music]", "Okay."]) world.voice.emitCloud?.({ type: "transcript", sessionId: relay, text: heard, final: false }); await expectIgnoredOverAlpha("(coughs)"); @@ -562,7 +562,7 @@ describe("Voice Bug 1 & Bug 3 journeys", () => { expect(world.ask.said).toEqual(["Tell me a story", "Wait, what time is it"]); }); - // spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words, a voice far from the phone, or Alpha's own voice never does" + // spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words or Alpha's own voice never does" it.each([ { prompt: "Message Shaw", @@ -624,7 +624,7 @@ describe("Voice Bug 1 & Bug 3 journeys", () => { expect([world.ask.said, world.voice.spoken.map((one) => one.text)]).toEqual([["What time is it"], ["It is noon."]]); }); - // spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words, a voice far from the phone, or Alpha's own voice never does"; spec/app/voice/index.md, "When the whole reply has been heard, Alpha listens for the next turn" + // spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words or Alpha's own voice never does"; spec/app/voice/index.md, "When the whole reply has been heard, Alpha listens for the next turn" it("on the phone's own recognizer, stays in Speaking until local playback ends, refuses leaked transcripts while speaking, and drops near-matching phonetic echoes like 'Top account.' for 'tap Accounts'", async () => { const world = { ...scene(), phone: true, signedIn: false }; const runtime = await startListening(world); @@ -1438,7 +1438,7 @@ describe("Talk from Ask Alpha's composer (spec/app/voice/index.md, \"Story: Hold expect([world.ask.said, world.voice.spoken.slice(spokenBefore).map(({ text }) => text)]).toEqual([["Take your time", "Are you there"], ["You said, Are you there"]]); }); - // spec/app/voice/index.md, "A heard turn waits for the send in hand, is sent once after it, and is given up quietly only after 30 s"; spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words, a voice far from the phone, or Alpha's own voice never does" + // spec/app/voice/index.md, "A heard turn waits for the send in hand, is sent once after it, and is given up quietly only after 30 s"; spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words or Alpha's own voice never does" it("sends a turn the owner says over Alpha once, after the turn it interrupted has let go of the agent", async () => { const world = { ...scene(), phone: true, signedIn: false }; const { alpha, area } = await talkingOnComposer(world); @@ -2146,7 +2146,7 @@ describe("Talk from Ask Alpha's composer (spec/app/voice/index.md, \"Story: Hold say(capture, "speech-start"); say(capture, "partial", { seq: 1, text: "[Music]" }); }); - // spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words, a voice far from the phone, or Alpha's own voice never does": a sound tag is never shown as the owner's words. + // spec/app/voice/index.md, "Only the owner's words interrupt Alpha, thinking or speaking; a sound without words or Alpha's own voice never does": a sound tag is never shown as the owner's words. expect(seenInterim()).toBeUndefined(); await drawn(() => { say(capture, "partial", { seq: 1, text: "And then" }); diff --git a/spec/app/voice/index.md b/spec/app/voice/index.md index f5131dde69..64daa32782 100644 --- a/spec/app/voice/index.md +++ b/spec/app/voice/index.md @@ -1003,7 +1003,7 @@ pure def stepChangingOutputKeepsTheMicrophone(before: Voice, via: str, after: Vo (via == "setSpeakerMuted" or via == "speakerSet") implies (before.mic == after.mic and before.muted == after.muted) ``` -### Only the owner's words interrupt Alpha, thinking or speaking; a sound without words, a voice far from the phone, or Alpha's own voice never does +### Only the owner's words interrupt Alpha, thinking or speaking; a sound without words or Alpha's own voice never does The owner's speech stops Alpha at once: the reply is hushed and what the owner says is the next turn. Everything Alpha is saying and has just said, @@ -1065,14 +1065,17 @@ it; an owner's one- or two-word answer outside the interrupt words, such as "okay" or "sounds good" said as Alpha stops, is dropped; and a sound written as words while Alpha thinks, away from its voice, gives up the reply. -Words heard while Alpha thinks or speaks that are quieter than a voice at -arm's length, such as a television across the room, do not interrupt it; -when Alpha listens they are still the owner's turn. That loudness is set -from what the voice QA harness measures on the owner's Pixel; until it has -measured the level the recognizer reports, the threshold is a placeholder. -The Cloud speech relay reports no level, and the phone's recognizer reports -one only where eliza measures it, so a far voice heard without a level -counts as near and is not kept out. +How loud the words were never decides whether they are the owner's. Discovered +on the owner's Pixel with the voice QA harness, on the phone's recognizer: +while Alpha speaks, the level of what is heard is set by Alpha's own echo +and the echo canceller, so the owner's "Wait, what time is it?", "No." and +"Wait" were heard at -40 to -46 dBFS, below the -38 dBFS a near voice had to +reach, and never interrupted Alpha; a television's words, played 15 dB +quieter, were heard at -43 to -48.5 dBFS, in the same band. The owner chose +words interrupting Alpha as a requirement and a television not interrupting +it as best effort, so words from a television or across the room that are +not Alpha's echo and are more than a stray word or pair do interrupt it; the +voice QA harness reports how often. Once the owner's words have interrupted Alpha, that segment is theirs, on either recognizer: a run of at least three words that opens it, as Alpha @@ -1086,11 +1089,9 @@ because the phone's voice detector alone hushed it; and over the Cloud speech relay an empty transcript of what was heard so far hushed Alpha. ```quint -type Heard = Words | Filler | Stray | NoWords | Echo | Distant +type Heard = Words | Filler | Stray | NoWords | Echo -type Hearing = { words: int, fillers: int, first: str, second: str, echo: bool, overAlpha: bool, duringAlpha: bool, levelDb: int } - -pure val nearFieldDb = -38 +type Hearing = { words: int, fillers: int, first: str, second: str, echo: bool, overAlpha: bool, duringAlpha: bool } pure val interruptWords = Set( "stop", "wait", "no", "nope", "yes", "yep", "pause", "hold", "hey", "cancel", @@ -1105,12 +1106,11 @@ pure def shortStray(h: Hearing): bool = pure def heardOf(h: Hearing): Heard = if (h.words + h.fillers <= 0) NoWords else if (h.overAlpha and h.echo) Echo - else if (h.words <= 0) (if (h.levelDb < nearFieldDb) NoWords else Filler) + else if (h.words <= 0) Filler else if (shortStray(h)) Stray - else if (h.levelDb < nearFieldDb) Distant else Words -pure def makesATurn(heard: Heard): bool = heard == Words or heard == Distant +pure def makesATurn(heard: Heard): bool = heard == Words pure def interrupts(phase: Phase, heard: Heard): bool = (phase == Speaking and (heard == Words or heard == Filler)) or (phase == Thinking and heard == Words) @@ -1126,29 +1126,28 @@ pure def answering(phase: Phase, session: int): Voice = { ...initial, phase: phase, mic: On, duplex: true, session: session, turn: 1, sent: 1, queued: if (phase == Speaking) 1 else 0, playing: if (phase == Speaking) 1 else 0 } -pure def oneWord(word: str): Hearing = { words: 1, fillers: 0, first: word, second: "", echo: false, overAlpha: true, duringAlpha: true, levelDb: -20 } +pure def oneWord(word: str): Hearing = { words: 1, fillers: 0, first: word, second: "", echo: false, overAlpha: true, duringAlpha: true } pure val hearingValues = Set( - { words: 0, fillers: 0, first: "", second: "", echo: false, overAlpha: true, duringAlpha: true, levelDb: -20 }, - { words: 0, fillers: 1, first: "", second: "", echo: false, overAlpha: true, duringAlpha: true, levelDb: -20 }, - { words: 0, fillers: 1, first: "", second: "", echo: false, overAlpha: false, duringAlpha: false, levelDb: -50 }, - { words: 3, fillers: 0, first: "", second: "", echo: true, overAlpha: true, duringAlpha: true, levelDb: -20 }, - { words: 3, fillers: 0, first: "", second: "", echo: true, overAlpha: false, duringAlpha: false, levelDb: -20 }, - { words: 2, fillers: 0, first: "", second: "", echo: false, overAlpha: true, duringAlpha: true, levelDb: -50 }, - { words: 2, fillers: 0, first: "", second: "", echo: false, overAlpha: false, duringAlpha: false, levelDb: -50 }, - { words: 2, fillers: 1, first: "", second: "", echo: false, overAlpha: true, duringAlpha: true, levelDb: -38 }, - { words: 1, fillers: 0, first: "yeah", second: "", echo: false, overAlpha: true, duringAlpha: true, levelDb: -20 }, - { words: 1, fillers: 0, first: "okay", second: "", echo: false, overAlpha: false, duringAlpha: false, levelDb: -20 }, - { words: 1, fillers: 1, first: "oh", second: "", echo: false, overAlpha: true, duringAlpha: true, levelDb: -20 }, - { words: 1, fillers: 0, first: "stop", second: "", echo: false, overAlpha: true, duringAlpha: true, levelDb: -20 }, - { words: 1, fillers: 0, first: "yes", second: "", echo: false, overAlpha: true, duringAlpha: true, levelDb: -20 }, - { words: 1, fillers: 0, first: "yeah", second: "", echo: false, overAlpha: true, duringAlpha: true, levelDb: -50 }, - { words: 1, fillers: 0, first: "wait", second: "", echo: true, overAlpha: true, duringAlpha: true, levelDb: -20 }, - { words: 2, fillers: 0, first: "long", second: "anyone", echo: false, overAlpha: true, duringAlpha: true, levelDb: -20 }, - { words: 2, fillers: 0, first: "and", second: "very", echo: false, overAlpha: false, duringAlpha: false, levelDb: -20 }, - { words: 2, fillers: 0, first: "captain", second: "wait", echo: false, overAlpha: true, duringAlpha: true, levelDb: -20 }, - { words: 3, fillers: 0, first: "tell", second: "me", echo: false, overAlpha: true, duringAlpha: true, levelDb: -20 }, - { words: 2, fillers: 0, first: "and", second: "friday", echo: false, overAlpha: true, duringAlpha: false, levelDb: -20 }) + { words: 0, fillers: 0, first: "", second: "", echo: false, overAlpha: true, duringAlpha: true }, + { words: 0, fillers: 1, first: "", second: "", echo: false, overAlpha: true, duringAlpha: true }, + { words: 0, fillers: 1, first: "", second: "", echo: false, overAlpha: false, duringAlpha: false }, + { words: 3, fillers: 0, first: "", second: "", echo: true, overAlpha: true, duringAlpha: true }, + { words: 3, fillers: 0, first: "", second: "", echo: true, overAlpha: false, duringAlpha: false }, + { words: 2, fillers: 0, first: "", second: "", echo: false, overAlpha: true, duringAlpha: true }, + { words: 2, fillers: 0, first: "", second: "", echo: false, overAlpha: false, duringAlpha: false }, + { words: 2, fillers: 1, first: "", second: "", echo: false, overAlpha: true, duringAlpha: true }, + { words: 1, fillers: 0, first: "yeah", second: "", echo: false, overAlpha: true, duringAlpha: true }, + { words: 1, fillers: 0, first: "okay", second: "", echo: false, overAlpha: false, duringAlpha: false }, + { words: 1, fillers: 1, first: "oh", second: "", echo: false, overAlpha: true, duringAlpha: true }, + { words: 1, fillers: 0, first: "stop", second: "", echo: false, overAlpha: true, duringAlpha: true }, + { words: 1, fillers: 0, first: "yes", second: "", echo: false, overAlpha: true, duringAlpha: true }, + { words: 1, fillers: 0, first: "wait", second: "", echo: true, overAlpha: true, duringAlpha: true }, + { words: 2, fillers: 0, first: "long", second: "anyone", echo: false, overAlpha: true, duringAlpha: true }, + { words: 2, fillers: 0, first: "and", second: "very", echo: false, overAlpha: false, duringAlpha: false }, + { words: 2, fillers: 0, first: "captain", second: "wait", echo: false, overAlpha: true, duringAlpha: true }, + { words: 3, fillers: 0, first: "tell", second: "me", echo: false, overAlpha: true, duringAlpha: true }, + { words: 2, fillers: 0, first: "and", second: "friday", echo: false, overAlpha: true, duringAlpha: false }) pure val wordValues = Set("stop", "wait", "no", "yes", "yep", "um", "yeah", "okay", "oh", "have", "you", "") @@ -1160,23 +1159,20 @@ pure def lawAlphasEchoNeverInterruptsItOrBecomesATurn(hearing: Hearing, phase: P (hearing.overAlpha and hearing.echo) implies (not(makesATurn(heardOf(hearing))) and not(canBargeIn(answering(phase, session), session, heardOf(hearing)))) -pure def lawAVoiceFarFromThePhoneNeverInterruptsAlpha(hearing: Hearing, phase: Phase, session: int): bool = - (hearing.levelDb < nearFieldDb) implies not(canBargeIn(answering(phase, session), session, heardOf(hearing))) - pure def lawAStrayWordOrPairOverAlphaNeverInterruptsItNorBecomesATurn(hearing: Hearing, phase: Phase, session: int): bool = shortStray(hearing) implies (not(makesATurn(heardOf(hearing))) and not(canBargeIn(answering(phase, session), session, heardOf(hearing)))) pure def lawAFewWordsAwayFromAlphaAreTheOwnersTurn(word: str): bool = - heardOf({ words: 1, fillers: 0, first: word, second: "", echo: false, overAlpha: false, duringAlpha: false, levelDb: -20 }) == Words - and heardOf({ words: 2, fillers: 0, first: word, second: word, echo: false, overAlpha: false, duringAlpha: false, levelDb: -20 }) == Words + heardOf({ words: 1, fillers: 0, first: word, second: "", echo: false, overAlpha: false, duringAlpha: false }) == Words + and heardOf({ words: 2, fillers: 0, first: word, second: word, echo: false, overAlpha: false, duringAlpha: false }) == Words pure def lawTwoWordsBegunAfterAlphasVoiceEndedAreTheOwnersTurn(word: str): bool = - heardOf({ words: 2, fillers: 0, first: word, second: word, echo: false, overAlpha: true, duringAlpha: false, levelDb: -20 }) == Words + heardOf({ words: 2, fillers: 0, first: word, second: word, echo: false, overAlpha: true, duringAlpha: false }) == Words pure def lawThreeWordsOverAlphaThatAreNotItsEchoInterruptIt(session: int): bool = canBargeIn(answering(Speaking, session), session, - heardOf({ words: 3, fillers: 0, first: "tell", second: "me", echo: false, overAlpha: true, duringAlpha: true, levelDb: -20 })) + heardOf({ words: 3, fillers: 0, first: "tell", second: "me", echo: false, overAlpha: true, duringAlpha: true })) pure def lawShortInterruptWordsInterruptAlpha(word: str, session: int): bool = interruptWords.contains(word)