top

Text To Speech

Many Tizen users have different abilities that require them to interact with TV in different ways. These include users who have visual, physical or age-related limitations that prevent them from fully seeing or using a TV, and users with hearing loss who may not be able to perceive audible information and alerts.

Samsung Smart TV(Legacy TV of Orsay platform) supports Web Speech API, you can use TTS (Text to speech) feature to support accessibility of your application.

Basic Usage

If user turns on Accessibility option for TTS in menu, TTS will read contents of HTML elements automatically.

TTS feature can be access using following sequence on remote controller:
TV Menu > System > Accessibility > Voice Guide > On

Note

Please note that if your TV doesn't support Voice Guide function, you might not be able to find "Voice Guide" menu in your TV

1. Web Speech

This API allows the application to control all the text to be spoken by the device;
This is possible by using the SpeechSynthesys interface of the Web Specch API.

WebSpeech basic example:

var synth = window.speechSynthesis;
var text = "Any text that should be spoken";
var ttsObject = new SpeechSynthesisUtterance(text);

ttsObject.ON-END = function(event) {
	console.log('Utterance has finished being spoken after ' + event.elapsedTime + ' milliseconds.');
}

ttsObject.ON-START = function(event) {
	console.log('We have started uttering this speech: ', event);
}

synth.speak(ttsObject);// Device will start to speak "Any text that should be spoken"

1.1 Voice Guide status.

CP could get current status of Voice Guide menu to enable TTS feature.

CP needs to activate TTS when the Voice Guide value is set to ON(true).

HTML

<!--Required to use Voice Guide API-->

<script type="text/javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/webapis.js"></script>

Javascript

//TTS enabled true/false
//true : Voice Guide is ON
//false : Voice Guide is OFF

webapis._plugin("RECOG", "IsTTSEngineEnabled")

1.2 HTML5 Web Speech API Specification

SpechSynthesis Attributes

Attribute Description
pending attribute This attribute will be set to true if there are utterances in the queue that have not yet started speaking.
speaking attribute This attribute will be true if an utterance is currently being spoken.

SpechSynthesis Methods

Method Description
speak(SpeechSynthesisUtterance) This method should be passed an instance of SpeechSynthesisUtterance. It will then add this to the queue of utterances that need to be spoken.
cancel() This method will remove all utterances from the queue. If an utterance is currently being spoken, it will be stopped.

SpeechSynthesisUtterance Attributes

Attribute Description
text attribute This attribute specifies the text to be synthesized and spoken for this utterance.

1.3 Web Speech API Platform Limitation

We have Platform side limitation for some API/Attibutes below.

Java Script classes Java Script APIs/Attributes Remark
SpeechSynthesis pause() Voice Rendering Engine(tts) in Orsay does not support Pause/Resume functionality. Hence this API cannot be supported as part of WebSpeech text to speech feature to CP's
resume() Voice Rendering Engine(tts) in Orsay does not support Pause/Resume functionality. Hence this API cannot be supported as part of WebSpeech text to speech feature to CP's
getVoices() API's to support Set Language and Set Speaker are are not implemented in Service extension framework(SEF) component of Voice Engine, default voice type(FEMALE) and language type(as per TV settings) needs to be used by Application
readonly attribute boolean paused Voice Rendering Engine(tts) in Orsay does not support Pause/Resume functionality. Hence this API cannot be supported as part of WebSpeech text to speech feature to CP's
SpeechSynthesisUtterance attribute DOMString lang API's to set/get all these attributes are are not implemented in Service extension framework(SEF) component of Voice Engine
attribute DOMString voiceURI
attribute float volume
attribute float rate
attribute float pitch
SpeechSynthesisEvent attribute EventHandler ON-ERROR Voice Rendering Engine(tts) in Orsay does not support Pause/Resume functionality. Hence these attributes that are related to pause/resume functionality are not supported
attribute EventHandler ON-PAUSE
attribute EventHandler ON-RESUME
attribute EventHandler onmark
attribute EventHandler onboundary
SpeechSynthesisVoice readonly attribute DOMString voiceURI API's to support Set Language and Set Speaker are are not implemented in Service extension framework(SEF) component of Voice Engine, All these attributes require either setting or getting language/voice type etc Hence cannot be supported
readonly attribute DOMString name
readonly attribute DOMString lang
readonly attribute boolean localService
readonly attribute boolean default