You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Service workers have a strict CORS policy which means you need to serve the model from the same domain via https, otherwise the browser will not allow downloading the model.
I understand, but we don´t think that is the problem since the model loads correctly and the browser even asks permission to use the mic, which also only works on secure networks. Right?
I tested on Opera, Chrome, and Mozilla.
Hello team!
I am testing your software using apache2 on a virtual machine running a Ubuntu server on windows.
This is the index and I was trying to test the microphone input.
2
1
3 <script type="application/javascript" src="https://cdn.jsdelivr.net/npm/vosk-browser@0.0.5/dist/vosk.js"></script>
1
2
3
4
5 <script>
6 async function init() {
7 const model = await Vosk.createModel('https://ccoreilly.github.io/vosk-browser/models/vosk-model-small-en-us-0.15.tar.gz');
8
9 const recognizer = new model.KaldiRecognizer();
10 recognizer.on("result", (message) => {
11 console.log(Result: ${message.result.text});
12 });
13 recognizer.on("partialresult", (message) => {
14 console.log(Partial result: ${message.result.partial});
15 });
16
17 const mediaStream = await navigator.mediaDevices.getUserMedia({
18 video: false,
19 audio: {
20 echoCancellation: true,
21 noiseSuppression: true,
22 channelCount: 1,
23 sampleRate: 16000
24 },
25 });
26
27 const audioContext = new AudioContext();
28 const recognizerNode = audioContext.createScriptProcessor(4096, 1, 1)
29 recognizerNode.onaudioprocess = (event) => {
30 try {
31 recognizer.acceptWaveform(event.inputBuffer)
32 } catch (error) {
33 console.error('acceptWaveform failed', error)
34 }
35 }
36 const source = audioContext.createMediaStreamSource(mediaStream);
37 source.connect(recognizerNode);
38 }
39
40 window.onload = init;
41 </script>
42
43
44 Hola!
45
46
~
The result on console is the repetition of the following lines:
Recognizer (id: d6562c55-8db5-4918-9c65-fc0d1f061ff2): Sending audioChunk vosk.js:333:29
Recognizer (id: d6562c55-8db5-4918-9c65-fc0d1f061ff2): process audio chunk with sampleRate 192000 94bb588b-5609-4bb8-bd34-b6f9f1c4968e:269:25
Recognizer (id: d6562c55-8db5-4918-9c65-fc0d1f061ff2): process audio chunk with sampleRate 192000 94bb588b-5609-4bb8-bd34-b6f9f1c4968e:269:25
Recognizer not ready, ignoring 94bb588b-5609-4bb8-bd34-b6f9f1c4968e:271:29
Recognizer not ready, ignoring 94bb588b-5609-4bb8-bd34-b6f9f1c4968e:271:29
Recognizer (id: d6562c55-8db5-4918-9c65-fc0d1f061ff2): Sending audioChunk vosk.js:333:29
Recognizer (id: d6562c55-8db5-4918-9c65-fc0d1f061ff2): process audio chunk with sampleRate 192000 94bb588b-5609-4bb8-bd34-b6f9f1c4968e:269:25
Recognizer not ready, ignoring 94bb588b-5609-4bb8-bd34-b6f9f1c4968e:271:29
Recognizer not ready, ignoring 94bb588b-5609-4bb8-bd34-b6f9f1c4968e:271:29
Could you please help me?
Thanks in advance
The text was updated successfully, but these errors were encountered: