1

I'm testing the native speech synthesizer in firefox, it works fine, only the pause () function fails, but in chrome, I have more errors, it only plays a short part of the text, only the first 200 characters, and it doesn't play everything else, I tried the library external meSpeak.js and if it plays everything but it takes a long time to load text of 1842 characters with which I did the test, I am using ubuntu system with chrome version 81.0.4044.92 url for testing https://mdn.github.io/web-speech-api/speak-easy-synthesis/ any solution for chrome ?? Thanks

Avrahamz
  • 48
  • 1
  • 6
  • oh i did a repeated question, i find the solution here https://stackoverflow.com/a/23808155/2596960 – Avrahamz Sep 22 '20 at 01:40

1 Answers1

0

I believe this is an issue with the speech synthesizer chosen. If you choose a local voice - one for which the audio can be generated simply by running in-browser / in-OS code on your local computer - then there should be no character limit, unless the voice you chose has such a limit, which doesn't seem likely

For example, on Windows, the two local voices I have are Microsoft David Desktop and Microsoft Zira Desktop. If I select these voices, the whole text gets played, regardless of length.

In contrast, other voices such as those from Google (eg Google US English) are not local; they may need to make a network request to parse the text into audio. Google's speech API seems to have a 200 character or so limit on how much text can be translated at once.

If the character limit is a problem, select a voice which is local, rather than one from Google.

Here's a snippet that'll list your available voices, as well as which are local or not:

const populateVoiceList = () => {
  console.log('Logging available voices');
  for (const voice of speechSynthesis.getVoices()) {
    console.log(voice.name, 'local: ' + voice.localService);
  }
};
populateVoiceList();
speechSynthesis.onvoiceschanged = populateVoiceList;
CertainPerformance
  • 356,069
  • 52
  • 309
  • 320