Why are Voices and speech in my app?


#1

While testing an app I had an error and used the Console to check it out. I then noticed some code preceding the error as follows:

“…NSB.loadVoices=function(){NSB.voices=speechSynthesis.getVoices();NSB.speech=newSpeechSynthesisUtterance();NSB.speech.lang=navigator.language;}…”

I found the problem which was not a coding issue but an invalid url to a POST, but I am curious as to why these NSB.loadVoices and speechSynthesis are in the appp.

Thanks, John


#2

They’re used by the Speak() function:

http://wiki.nsbasic.com/Speak

We wanted to make this function as easy as possible to use. Initializing the voices requires some advanced programming, so we load them in at startup by default. It takes a very little time or memory to do so.