speech-synthesis

Web speech API: Consistently get the supported speech synthesis voices on iOS safari

我只是一个虾纸丫 提交于 2021-02-06 09:21:11
问题 I'm trying to get the list of supported speech synthesis voices on iOS Safari. As per the API, I should be able to get an array of voices by calling: window.speechSynthesis.getVoices(); Sometimes this gives me list of voices, other times it doesn't. See the following jsfiddle: https://jsfiddle.net/sq7xf327/ If I open this on my iPhone 5 (iOS 8.1.3), I don't get back consistent results. Sometimes I get back all 37 voices, and other times I get returned 0 voices. If you keep on refreshing it

How can I get female voice by Web Speech API in Google Chrome

﹥>﹥吖頭↗ 提交于 2021-01-27 15:02:12
问题 In a webpage, I want a female voice to speak my texts. I tried to do this by following code. But still now male voice is talking. How can I arrange a female voice to talk my texts? Can anybody share me a correct code that works in Google Chrome. var voices = speechSynthesis.getVoices(); var msg = new SpeechSynthesisUtterance("Hello World!"); msg.default=false; msg.localservice=true; msg.lang = "en-GB"; msg.voice = voices[3].name; speechSynthesis.speak(msg); 回答1: The below code worked for me.

In JavaScript, for text to speech, when the voiceschanged event was being listened to, nothing happened with an array of voices? [duplicate]

爷,独闯天下 提交于 2020-03-02 07:52:06
问题 This question already has answers here : Getting the list of voices in speechSynthesis (Web Speech API) (11 answers) Closed last month . Related to this text to speech question, I have the following code: First of all, I am not sure if this is the best way to write the code, because it is initializing, and then setting a listener to "call itself". (seems a little bit hacky). Second, although the listeners got "notified", the voices.length is still 0 . Nothing really happens with an array of

How to change voice in Speech Synthesis?

懵懂的女人 提交于 2020-01-24 11:18:08
问题 I am trying out a simple example with Speechsynthesis. <script> voices = window.speechSynthesis.getVoices() var utterance = new SpeechSynthesisUtterance("Hello World"); utterance.voice = voices[4]; utterance.lang = voices[4].lang; window.speechSynthesis.speak(utterance); </script> But this gives an error that voices is undefined. I found that getVoices() is loaded async. I saw this answer and updated my code as shown below to use callback. <script> window.speechSynthesis.onvoiceschanged =

Is there some voice or speech ready event in JavaScript? [duplicate]

£可爱£侵袭症+ 提交于 2020-01-24 10:21:21
问题 This question already has answers here : Getting the list of voices in speechSynthesis (Web Speech API) (11 answers) Closed 7 days ago . I tried the following on Google Chrome. It'd print out 0 voices, and again print out 0 voices on my computer, but if I reload the page to start fresh, and change the last line to setTimeout(foo, 1000) , then the first line would print out 0 and second line, 87 . The number could even be changed to 66 or 33 and it worked, but I am not sure whether it depends

Is there some voice or speech ready event in JavaScript? [duplicate]

寵の児 提交于 2020-01-24 10:13:41
问题 This question already has answers here : Getting the list of voices in speechSynthesis (Web Speech API) (11 answers) Closed 7 days ago . I tried the following on Google Chrome. It'd print out 0 voices, and again print out 0 voices on my computer, but if I reload the page to start fresh, and change the last line to setTimeout(foo, 1000) , then the first line would print out 0 and second line, 87 . The number could even be changed to 66 or 33 and it worked, but I am not sure whether it depends

SpeechSynthesis.speak (in Web Speech API) always stops after a few seconds in Google Chrome

只愿长相守 提交于 2020-01-21 10:52:47
问题 When using the speak function in the Web Speech API, in Chrome the speaking stops abruptly after a few seconds, in the middle of the text given to it, in a seemingly random place (without reaching the end). This only happens in Chrome (works well on Firefox), tested on two different computers/systems. Have a look at this jsfiddle to see/listen: https://jsfiddle.net/fv9ochpq/ You can see that the SpeechSynthesis object .speaking flag stays on(true) after it stops speaking. I haven't seen any

SpeechSynthesis.speak (in Web Speech API) always stops after a few seconds in Google Chrome

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-21 10:52:10
问题 When using the speak function in the Web Speech API, in Chrome the speaking stops abruptly after a few seconds, in the middle of the text given to it, in a seemingly random place (without reaching the end). This only happens in Chrome (works well on Firefox), tested on two different computers/systems. Have a look at this jsfiddle to see/listen: https://jsfiddle.net/fv9ochpq/ You can see that the SpeechSynthesis object .speaking flag stays on(true) after it stops speaking. I haven't seen any

JS Speech Synthesis Issue on iOS

跟風遠走 提交于 2020-01-13 09:48:10
问题 I recently implemented a basic web app which relied on Google's TTS URL to generate clear MP3 files for playback on the front end. This has since been subject to an additional security check, meaning I have had to update the code base to use alternative methods. One such alternative is javascript's speech synthesis API, i.e. SpeechSynthesisUtterance() and window.speechSynthesis.speak('...'). This works really well on my desktop and laptop but as soon as I use it on my iOS devices, the rate of