@mjyc/voice-activity-detection
v1.0.0
Published
Mic input activity detection
Downloads
145
Readme
voice-activity-detection
Syntax
vad(audioContext, stream [, options]);
Default options:
{
fftSize: 1024,
bufferLen: 1024,
smoothingTimeConstant: 0.2,
minCaptureFreq: 85, // in Hz
maxCaptureFreq: 255, // in Hz
noiseCaptureDuration: 1000, // in ms
minNoiseLevel: 0.3, // from 0 to 1
maxNoiseLevel: 0.7, // from 0 to 1
avgNoiseMultiplier: 1.2,
onVoiceStart: function() {},
onVoiceStop: function() {},
onUpdate: function(val) {}
}
minCaptureFreq/maxCaptureFreq
- human voice frequency rangenoiseCaptureDuration
- time for measuring average env. noise before starting voice activity detectionminNoiseLevel/maxNoiseLevel
- env. noise level normalization range (duringnoiseCaptureDuration
)avgNoiseMultiplier
- multiplier for the average env. noise level to set activity/inactivity state toggle
Usage
See example code
Test
npm run test