UNPKG

speech-detector

Version:

A node.js library for detecting speech in audio using Silero's VAD model

29 lines (28 loc) 1.08 kB
/// <reference types="node" /> import { ReadableStream } from "node:stream/web"; declare class SpeechDetector { private silero; private frameSamples; private positiveSpeechThreshold; private negativeSpeechThreshold; private redemptionFrames; private minSpeechFrames; private speechSegmentsStreamController; private currentSpeechSegment; private speaking; private redemptionCounter; private speechFrameCount; private frameCount; private constructor(); static create(frameSamples?: number, positiveSpeechThreshold?: number, negativeSpeechThreshold?: number, redemptionFrames?: number, minSpeechFrames?: number): Promise<SpeechDetector>; private resetSpeechDetection; private emitSpeechSegment; private startNewSpeechSegment; private appendToCurrentSpeechSegment; private finalizeSpeechSegment; private handleNonSpeechFrame; private handleSpeechProbability; process(audio: ReadableStream<Float32Array>): ReadableStream<Float32Array>; private processAudioChunk; } export { SpeechDetector };