0

So far I have been able to convert about 4-5 words from speech to text using the Webspeech API.

my source looks like this;

var SpeechRecognition = SpeechRecognition || webkitSpeechRecognition
var recognition = new SpeechRecognition();
recognition.lang = 'en-US';
recognition.interimResults = false;
recognition.maxAlternatives = 1;
document.body.onclick = function() {
  recognition.start();
}

recognition.onresult = function(event) {
  var i = event.results.length-1;

  var j = event.results[i].length-1;
  var text = event.results[i][j].transcript;

  diagnostic.textContent = 'Result received: ' + text + '.';
  console.log('Confidence: ' + event.results[i][j].confidence);
}

recognition.onspeechend = function() {
  recognition.stop();
}

recognition.onerror = function(event) {
  diagnostic.textContent = 'Error occurred in recognition: ' + event.error;
}

So when I say anymore words than 5-6 I get an Error occurred in recognition: network error.

if I say less words it works fine.

I also tried setting the recognition.continuous variable for what it's worth it did not work.

is there no way I can convert long speeches to text in browser using a free speech to text API?

if so point me in the direction.

or should I convert recorded audio to text in the backend by sending audio to the backend? if so how to do that?

vkp
  • 91
  • 4
  • 17
  • Can't repro on Chrome 70 on macOs. Long sentences are gotten without a problem (well, not saying it's 100% accurate, but given my awful English pronunciation :-P). – Kaiido Nov 18 '18 at 08:21
  • are you saying that you were able to convert long sentences to text without anything added new in the above code I have put? – vkp Nov 19 '18 at 02:53
  • Yes that's what I mean. – Kaiido Nov 19 '18 at 02:57
  • Even I am using chrome 70 and am not able to get past 5 words. Should I add any specific grammar to recognition object? – vkp Nov 19 '18 at 08:05
  • can you provide me code? – vkp Nov 19 '18 at 10:30

0 Answers0