Add delete to recognizer
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
# Overview
|
# Overview
|
||||||
- A speech recognizer built on Vosk that can be run on the browser, inspired by [vosk-browser](https://github.com/ccoreilly/vosk-browser), but built from scratch and no code taken!
|
- A lightweight speech recognizer built on Vosk that can be run on the browser, inspired by [vosk-browser](https://github.com/ccoreilly/vosk-browser), but built from scratch and no code taken!
|
||||||
- Designed with basic/nothrow exception safety
|
- Designed with basic/nothrow exception safety
|
||||||
- See the *examples* folder for examples on using the API.
|
- See the *examples* folder for examples on using the API.
|
||||||
- See *API.md* for the API reference
|
- See *API.md* for the API reference
|
||||||
@@ -42,9 +42,9 @@
|
|||||||
|
|
||||||
// Load Vosklet module, model and recognizer
|
// Load Vosklet module, model and recognizer
|
||||||
let module = await loadVosklet()
|
let module = await loadVosklet()
|
||||||
let model = await module.createModel("https://ccoreilly.github.io/vosk-browser/models/vosk-model-small-en-us-0.15.tar.gz","model","ID")
|
let model2 = await module.createModel("https://ccoreilly.github.io/vosk-browser/models/vosk-model-small-en-us-0.15.tar.gz","model","ID")
|
||||||
let recognizer = await module.createRecognizer(model, 16000)
|
let recognizer2 = await module.createRecognizer(model, 16000)
|
||||||
|
|
||||||
// Listen for result and partial result
|
// Listen for result and partial result
|
||||||
recognizer.addEventListener("result", ev => {
|
recognizer.addEventListener("result", ev => {
|
||||||
console.log("Result: ", ev.detail)
|
console.log("Result: ", ev.detail)
|
||||||
|
|||||||
@@ -141,6 +141,9 @@ class recognizer extends EventTarget {
|
|||||||
Module.HEAPF32.set(audioData, start / 4)
|
Module.HEAPF32.set(audioData, start / 4)
|
||||||
this.obj.pushData(start, audioData.length)
|
this.obj.pushData(start, audioData.length)
|
||||||
}
|
}
|
||||||
|
delete() {
|
||||||
|
this.obj.delete()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Module.createRecognizer = (model, sampleRate) => {
|
Module.createRecognizer = (model, sampleRate) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user