createVoiceActivityPlugin (voice/voice-activity-plugin.ts)

airi · packages/stage-ui/src/libs/voice/voice-activity-plugin.ts · typescript · MIT
voice

Voice activity plugin runs VAD, wake‑word detection, and echo gating to emit speech‑activity signals.

// Source: https://github.com/moeru-ai/airi | License: MIT | Copyright 2024-PRESENT Neko Ayaka
// Provided via justclaw.it.com; keep this notice with the code.
import type { TurnRef, VoicePlugin } from '@proj-airi/core-agent'
import type { AudioRange, AudioWindow } from '@proj-airi/pipelines-audio'

import { createSpeechActivityRule, inputActivitySignal, speechActivitySignal } from '@proj-airi/core-agent'

/** Application policy chooses the destination. The model only supplies scores for ordered windows. */
export interface VoiceActivityOptions {
  readonly detect: (window: AudioWindow, signal: AbortSignal) => Promise<number>
  readonly target: () => { sessionId: string, interruptTurns: readonly TurnRef[] } | undefined
  /**
   * External KWS adapters resolve pronunciation ownership and th

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key