speech-synthesis

Speech Synthesis API Highlight words as they are spoken

十年热恋 提交于 2019-12-04 06:12:20
Currently, I'm making a simple app where text is spoken using the speech synthesis API. I want to highlight the words (bold) as they are being spoken. I currently have a very basic implementation doing this using the 'onboundary' event. However, I'm wondering if there's a better/nicer way of doing it, as my implementation is based on a few presumptions. var words; var wordIdx; var text; var utterance = new SpeechSynthesisUtterance(); utterance.lang = 'en-UK'; utterance.rate = 1; window.onload = function(){ document.getElementById('textarea').innerText = 'This is a text area. It is used as a

How to add custom SR (Speech Recognition) to Microsoft SAPI

社会主义新天地 提交于 2019-12-04 02:19:42
问题 I have a Speech Recognition application for a Language X. This language is not supported by Microsoft SAPI. How can I add this SR for Language X to Microsoft SAPI so that I can use it via Microsoft SAPI ? So What I wonder is Can I add a custom SR to Microsoft SAPI? If so How? If It is a complex process, where to find details? 回答1: SAPI is just the application programming interface, it only provides the connector for the speech recognition engine. There could be multiple implementations of the

Can Web Speech API used in conjunction with Web Audio API?

浪子不回头ぞ 提交于 2019-12-03 23:53:10
问题 Is it possible to use the synthesised speech from Web Speech API as a SourceNode inside Web Audio API's audio context? 回答1: I actually asked about adding this on the Web Speech mailing list, and was basically told "no". To be fair to people on that mailing list, I was unable to think of more than one or two specific use cases when prompted. So unless they've changed something in the past month or so, it sounds like this isn't a planned feature. 回答2: You can use Google's Web Speech API, you

The right way to use SSML with Web Speech API

我是研究僧i 提交于 2019-12-03 11:25:37
Web Speech API specification says: text attribute This attribute specifies the text to be synthesized and spoken for this utterance. This may be either plain text or a complete, well-formed SSML document. For speech synthesis engines that do not support SSML, or only support certain tags, the user agent or speech engine must strip away the tags they do not support and speak the text. It does not provide an example of using text with an SSML document. I tried the following in Chrome 33: var msg = new SpeechSynthesisUtterance(); msg.text = '<?xml version="1.0"?>\r\n<speak version="1.0" xmlns=

Why does a SpeechSynthesisUtterance sometimes not fire an 'end' event in Chromium-based browsers?

隐身守侯 提交于 2019-12-03 09:54:51
In both Chrome (v72, W10) and Opera, the following snippet very occasionally does not seem to run the attached end listener to the SpeechSynthesisUtterance , maybe 1 out of 50 times the snippet is run. (Sorry, in the original version of this, it could be reproduced much more easily - now, creating the utterance on button click looks to have made the bug much more rare) button.onclick = () => { console.log('start script'); button.disabled = true; const utt = new SpeechSynthesisUtterance('e'); utt.addEventListener('end', () => { console.log('end event triggered'); }); // just for debugging

How to change the voice in pyttsx3?

心不动则不痛 提交于 2019-12-03 08:57:06
This code is working but I'm only able to switch between the voices which came preInstalled in Microsoft Windows. These voices are "Microsoft David Mobile" and "Microsoft Zira Mobile". Later I installed "Microsoft Kalpana Mobile" and set it as the default Windows voice. But still I'm not able to switch to "Microsoft Kalpana Mobile". The code is- import pyttsx3 engine = pyttsx3.init() voices = engine.getProperty('voices') engine.setProperty('voice', voices[0].id) #changing index changes voices but ony 0 and 1 are working here engine.say('Hello World') engine.runAndWait() Only 0 and 1 are

How to access audio result from Speech Synthesis API?

混江龙づ霸主 提交于 2019-12-03 07:07:35
The Speech Synthesis API allows text-to-speech functionality in Chrome Beta. However, results from TTS requests are automatically played by the browser. How do I access the audio results for post-processing and disable the default behavior of the API? There is no standard audio output for the TTS system and that seems quite intentional so it is unlikely to change anytime soon. To understand why, you can look at the other side of this interface where a browser extension can act as a TTS Engine and provide the voices the client can use: Being a valid TTS Engine accessible by this API in chrome

SpeechSynthesis API onend callback not working

梦想的初衷 提交于 2019-12-03 03:58:52
问题 I'm using the Speech Synthesis API on Google Chrome v34.0.1847.131. The API is implemented in Chrome starting in v33. The text-to-speech works for the most part, except when assigning a callback to onend . For instance, the following code: var message = window.SpeechSynthesisUtterance("Hello world!"); message.onend = function(event) { console.log('Finished in ' + event.elapsedTime + ' seconds.'); }; window.speechSynthesis.speak(message); will sometimes call onend and sometimes not call it.

SpeechSynthesis API onend callback not working

こ雲淡風輕ζ 提交于 2019-12-02 16:16:57
I'm using the Speech Synthesis API on Google Chrome v34.0.1847.131. The API is implemented in Chrome starting in v33. The text-to-speech works for the most part, except when assigning a callback to onend . For instance, the following code: var message = window.SpeechSynthesisUtterance("Hello world!"); message.onend = function(event) { console.log('Finished in ' + event.elapsedTime + ' seconds.'); }; window.speechSynthesis.speak(message); will sometimes call onend and sometimes not call it. The timing appears to be completely off. When it does get called, the printed elapsedTime is always some