@sherpaw/vad
v0.0.2
Published
A WebAssembly (WASM) wrapper for VAD (voice activity detection) with sherpa-onnx.
Downloads
26
Readme
@sherpaw/vad
A WebAssembly (WASM) wrapper for VAD (voice activity detection) with sherpa-onnx.
Quick start
import { createVad, initVADModule } from '@sherpaw/vad'
const vadModule = await initVADModule()
const vad = createVad(vadModule, {
sileroVad: {
model: './silero_vad.onnx',
},
sampleRate: 16000,
numThreads: 1,
provider: 'cpu',
debug: 0,
bufferSizeInSeconds: 30,
})
vad.acceptWaveform(mySamples)
if (vad.isDetected()) {
const segment = vad.front()
console.log(segment.start, segment.samples.length)
vad.pop()
}Notes
- The prebuilt files are generated by the native build in
sherpa-onnx/:packages/vad/src/prebuilt/vad.jsandpackages/vad/src/prebuilt/vad.wasm. - Follow the upstream VAD model guidance in
sherpa-onnx/upstream/wasm/vad/assets/README.md.
License
Copyright 2025 Makito
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.