User guide for node use
-
Install
@ricky0123/vad-node
:npm i @ricky0123/vad-node
No other setup is necessary.
-
Example usage:
const vad = require("@ricky0123/vad-node")
const options: Partial<vad.NonRealTimeVADOptions> = { /* ... */ }
const myvad = await vad.NonRealTimeVAD.new(options)
const audioFileData, nativeSampleRate = ... // get audio and sample rate from file or something
for await (const {audio, start, end} of myvad.run(audioFileData, nativeSampleRate)) {
// do stuff with
// audio (float32array of audio)
// start (milliseconds into audio where speech starts)
// end (milliseconds into audio where speech ends)
}See the docs for NonRealTimeVAD for details. That is the only currently supported API in node.