Package Exports
- @picovoice/web-voice-processor
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@picovoice/web-voice-processor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Web Voice Processor
Made in Vancouver, Canada by Picovoice
This is a library for real-time voice processing in web browsers.
- Uses Worker to offload compute-intensive work to background threads.
- Converts the microphone sampling rate to 16000 which is used by (almost all) voice processing engines.
- Provides a flexible interface to pass in arbitrary voice processing workers.
Compatibility
The library makes use of Web Audio API, which is supported on all modern browsers except Internet Explorer.
How to Install
npm install web-voice-processor
How to Use
Add the following to your HTML
<script src="{PATH_TO_WEB_VOICE_PROCESSOR_JS}"></script>
Replace {PATH_TO_WEB_VOICE_PROCESSOR_JS}
with the path to src/web_voice_processor.js.
The library adds WebVoiceProcessor
as a singleton to the global scope.
Start Processing
Start processing
window.WebVoiceProcessor.start(engines, downsamplerScript, errorCallback)
engines
is a list of voice processing Workers
implementing the following interface within their onmessage
method
onmessage = function (e) {
switch (e.data.command) {
...
case 'process':
process(e.data.inputFrame);
break;
...
}
};
where e.data.inputFrame
is an Int16Array
of 512 audio samples.
downsamplerScript
is the path to downsampling_worker.js relative to HTML file.
The errorCallback
is executed if audio acquisition fails.
Stop Processing
Stop processing
window.WebVoiceProcessor.stop()