UNPKG

@juspay/neurolink

Version:

The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002

29 lines (28 loc) • 1.24 kB
/** * Runs a speech detector over a stream's samples as they arrive and keeps * its verdicts on the stream clock, so the endpointer (which works on 20 ms * blocks at the input rate) can ask "was this moment speech?" without * knowing the detector's frame size or sample rate. Audio at another rate is * resampled to 16 kHz for scoring only; the engine path is untouched. * * @module voice/vad/frameScorer */ import type { STTSpeechDetector } from "../../types/index.js"; export declare class SpeechFrameScorer { readonly detector: STTSpeechDetector; private readonly probs; /** Frames scored so far: the detector's clock. */ private frames; private readonly frame; private frameFill; private readonly resampler; constructor(detector: STTSpeechDetector, inputRate: number); /** Scores every full frame the samples complete; a partial frame waits for the next push. */ push(samples: Float32Array): Promise<void>; /** * The probability of the frame covering `seconds` on the stream clock; the * newest frame when that one is not complete yet (a lag of at most one * frame), `undefined` before anything was scored. */ probabilityAt(seconds: number): number | undefined; }