Application:SpeechDispatcher

What is the Speech Dispatcher


This daemon provides speech synthesis. At the moment, it is only used by the Navit application and there is no dedicated application front-end, but a Mojo service and application will be developed in the future.

How does it work
The speech dispatcher is based on speechd. It accepts text via a sokect and/or C-API. This text is then sent sentence by sentence to a speech synthesizer. At the moment we have included espeak as the speech synthesizer.

Where I can get help
See the thread on Precentral: http://forums.precentral.net/showthread.php?p=2549731

Can my PDK app use this service
Yes it can. The C-Api is documented on the speechd home page => http://cvs.freebsoft.org/doc/speechd/speech-dispatcher.html#SEC42

The other way would be to use the spechd socked directly as doumented here => http://cvs.freebsoft.org/doc/speechd/ssip.html#Top

The default socket for the PalmPre is 'export SPEECHD_SOCKET=/tmp/speechd-sock'

Can my Mojo app use this service
Starting with version 0.7.1-14 the package contains 4 Javascript service that can be used in Mojo or Enjo Apps. The service url is palm://org.webosinternals.speechd.service and has the following methods:


 * Name: getOutput, Parameter: n.a. Returns the current default audio output channel in the 'reply' property.

this.request = new Mojo.Service.Request('palm://org.webosinternals.speechd.service', { 	method: 'getOutput', 	parameters: {}, 	onSuccess:	function(result) { 			this.setHtml(result.reply); 			delete this.request; 		}.bind(this), 	onFailure:	function(err) { 			delete this.request; 			Mojo.Log.error('Unable to get speech dispatcher audio output'); 			Mojo.Controller.errorDialog('Unable to get speech dispatcher audio output'); 			}.bind(this) 	});


 * Name: setOutput, Parameter: output. Set the default audio output channel. This channel is used for all text that is spoken from any application (e.g. Navit) that do not set a special audio channel. Use the output parameter of the say method if you only what to send this text to a specific audio channel (e.g. Use the espeak-ringtone output of the say method if you speak the caller name)

The allowed values for output are: espeak-voip: used for phone calls. This channel uses the devce speaker even if the device is connected to a buetooth output. If a phone call is active the audio is mixed into it. espeak-ringtones: Uses for ringtones espeak-feedback: espeak-alarm: Used for caledar or other device alarms espeak-media: all webOS appication audio output espeak-navigation: The running volume of audio from the media is reduced while the text is spoken. ATTATION: The seech output will be dissmissed if the phone is rining or an arlam is active All audio channes uses the device audio settinge. Example: If you use the espeak-ringtones output and the phone is on mute the text will not be spoken. If not on mute it will use the volume of the rintone settings settings.

this.request = new Mojo.Service.Request('palm://org.webosinternals.speechd.service', { 		method: 'setOutput', 		parameters: { 			"output":audio 		}, 	onSuccess:	function(result) { 				this.setHtml(audio); 				delete this.request; 			}.bind(this), 	onFailure:	function(err) { 				delete this.request; 				Mojo.Log.error('Unable to set speech dispatcher audio output'); 				Mojo.Controller.errorDialog('Unable to set speech dispatcher audio output'); 			}.bind(this) });

Parameter: say are all optional expect of text. The default language is English interdependent of the device setting! text: The test to be spoken language: text language (iso code) output: Use a special output instead of the default, the possible values are listet in the setOutput method rate: rate of the speech (between -100 and +100, default: 0) pitch: pitch of the speech (between -100 and +100, default: 0) volume: volume (intensity) of the speech (between -100 and +100, default: 0) type: voice type (male1, male2, male3, female1, female2, female3, child_male, child_female)
 * Name: say, Speak some text.

new Mojo.Service.Request('palm://org.webosinternals.speechd.service', { 		method: 'say', 		parameters: { 			language: "en", 			text: $L("Let us do a test") 		} 	});

You can test all methods from novaterm: root@HPPre3:/# luna-send -n 1 palm://org.webosinternals.speechd.service/checkperms '{}' {"reply":{"root":true,"homebrew":true},"returnValue":true} root@HPPre3:/# luna-send -n 1 palm://org.webosinternals.speechd.service/say '{"text":"Dies ist ein Test","language":"de","output":"espeak-ringtones"}' {"reply":"","error":"","returnValue":true} root@HPPre3:/# luna-send -n 1 palm://org.webosinternals.speechd.service/setOutput '{"output":"espeak-ringtones"}' {"reply":"(00639/790284550) org.webosinternals.speechd (stop) running, process 1221\n(00639/790559209) org.webosinternals.speechd (stop) pre-stop, (main) process 1221\n(00639/790681280) org.webosinternals.speechd (stop) stopping, process 1221\n(00639/791108526) org.webosinternals.speechd (stop) killed, process 1221\n(00639/791261114) org.webosinternals.speechd (stop) post-stop\n(00639/791566289) org.webosinternals.speechd (stop) waiting\n(00639/810426153) org.webosinternals.speechd (start) waiting\n(00639/810609259) org.webosinternals.speechd (start) starting\n(00639/810700811) org.webosinternals.speechd (start) pre-start\n(00639/810822882) org.webosinternals.speechd (start) spawned, process 2334\n(00639/812257208) org.webosinternals.speechd (start) post-start, (main) process 2334\n(00639/812409796) org.webosinternals.speechd (start) running, process 2334\n","error":"","returnValue":true} root@HPPre3:/# luna-send -n 1 palm://org.webosinternals.speechd.service/getOutput '{}' {"reply":"espeak-ringtones","error":"","returnValue":true}