text-to-speech

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

How to wait until speech is finished inside Loop?

一曲冷凌霜 提交于 2020-01-23 01:17:47
问题 I would like to halt/wait the for-loop until the window.speechSynthesis.speak(audio) finishes reading the text, then go to next iteration. I have below code: var all = "Oak is strong and also gives shade \n \ Cats and dogs each hate the other \n \ The pipe began to rust while new \n Bye." sentences = all.split('\n') for (i = 0; i < sentences.length; i++) { sentence = sentences[i] console.log(sentences[i]); audio = new SpeechSynthesisUtterance(sentence) window.speechSynthesis.speak(audio) }

TTS doesn't speak from a service whereas it does it from an activity in android

点点圈 提交于 2020-01-22 10:08:05
问题 I have been able to run TTS from an activity but when I try to execute the same code from a service, it's giving me message that TTS engine is initialised but not speaking anything. Has anybody encountered the same issue anytime? public void onCreate() { super.onCreate(); tts = new TextToSpeech(this, this //TextToSpeech.OnInitListener); timer.scheduleAtFixedRate( new TimerTask() { // In timer public void run() { //On some condition tts.speak("thank you", TextToSpeech.QUEUE_ADD, null); }, 0,

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

Howto access thread data outside a thread

Deadly 提交于 2020-01-16 03:42:09
问题 Question: I start the MS Text-to-speech engine in a thread, in order to avoid a crash on DLL_attach. It starts fine, and the text to speech engine gets initialized, but I can't access ISpVoice outside the thread. How can I access ISpVoice outside the thread ? It's a global variable after all... You find XPThreads here: http://www.codeproject.com/KB/threads/XPThreads.aspx #include <windows.h> #include <sapi.h> #include "XPThreads.h" ISpVoice * pVoice = NULL; unsigned long init_engine_thread

Text to speech pronouncing numbers like “4th”, “8ths”, or “2nd”

℡╲_俬逩灬. 提交于 2020-01-15 10:28:08
问题 A while back I wrote some code that would convert a Double into a String, where the string was formatted as a readable fraction. For an example 4.75 => "4 and 3 4ths" 1.5 => "1 and 1 half" 1.33 => "1 and 1 3rd" The majority of numbers are pronounced as intended with a few notable exceptions. Instead of the text "4ths" being pronounced as "fourths" it is pronounced "four tee ache ess". Here is an example demonstrating this. //this works tts.speak("1 and 3 fourths", TextToSpeech.QUEUE_FLUSH,

UtteranceProgressListener not being reliably called

北城余情 提交于 2020-01-15 03:35:42
问题 I am writing an Android app to fetch the latest email from a folder and play it using TTS. I want to be able to use it whilst driving so it has to be mostly automatic. Everything so far is working fine until I attempt to capture when the TextToSpeech has finished speaking so we can move on to the next email. Here is the complete MainActivity.java file: package uk.co.letsdelight.emailreader; import android.os.AsyncTask; import android.os.Bundle; import android.speech.tts.TextToSpeech; import