3

Presently when Speech Synthesis Markup Language (SSML) is set as at text property of SpeechSynthesisUtterance instance at Chromium or Firefox web browsers the SSML is not parsed at *nix as reflected at audio output of speechSynthesis.speak() call.

Browsing the source code of the browsers speech-dispatcher appears to be called by .speak() where either spd-say or espeak, if configured to do so, could be called by speech-dispatcher.

spd-say has an x option

-x, --ssml          Set SSML mode on (default: off)

espeak has an m option

-m     Interpret SSML markup, and ignore other < > tags

Have created a user configuration file for speech-dispatcher using

spd-conf -u

The documentation states that the user configuration file can be used to set parameters for specific clients

4.1.6 Parameter Settings Commands

The following parameter setting commands are available. For configuration and history clients there are also functions for setting the value for some other connection and for all connections. They are listed separately below.

C API function: int spd_set_data_mode(SPDConnection *connection, SPDDataMode mode) Set Speech Dispatcher data mode. Currently, plain text and SSML are supported. SSML is especially useful if you want to use index marks or include changes of voice parameters in the text.

mode is the requested data mode: SPD_DATA_TEXT or SPD_DATA_SSML.

Questions

  1. How to set the default option of either or both -x for spd-say and -m for espeak commands at ~/.config/speech-dispatcher/speechd.conf for the clients Chromium and Firefox browsers when .speak() is called?

  2. How to adjust the source code at Chromium and Firefox browsers to set the -x or -m options by default for the text set at SpeechSpeechSynthesisUtterance text property which is passed to window.speechSynthesis.speak()?

6
  • An alternative way that often works: Rename the binary/binaries, write a wrapper script that calls the binaries, and includes the options you want. Hacky, but possibly simpler. Another hacky way is to replace the name of the binary calls in the browser binary with the name of the wrapper script; this way you keep the standard names (but must redo this if you update your browser. Though it's scriptable with dd etc.) – dirkt Jan 12 '18 at 10:12
  • @dirkt Can you post the possible alternatives that you are describing in at an answer? – guest271314 Jan 12 '18 at 10:20
  • 1
    This question is cross-posted at Ask Ubuntu. -1. – Mukesh Sai Kumar Jan 13 '18 at 8:29
  • @MukeshSaiKumar What do you mean by "cross-posted"? – guest271314 Jan 13 '18 at 15:45
  • "Cross-posted": That the same question is already asked in one of the network sites, and would very well have gotten a good answer there. If it didn't, consider deleting the question there, or atleast updating that question with a link to the answer here, so that others having the same question may benefit. – Mukesh Sai Kumar Jan 13 '18 at 16:09
1

An alternative way that often works: Rename the binary/binaries, write a wrapper script with the origina name that calls the renamed binaries, and includes the options you want. Hacky, but possibly simpler. (If you are not used to shell programming, look up $*).

Another hacky way is to replace the name of the binary calls in the browser binary with the name of the wrapper script; this way you keep the standard names.

The downside is that you must redo this if you update your browser, though it's scriptable with grep and dd along the lines of

grep -FobUa 'spd-say' browser_binary
echo -n 'spd-wrp' | dd bs=1 of=browser_binary seek=12345 conv=notrunc

where spd-wrp is the name of the wrapper script, and 12345 the position where grep found it. Use variations for multiple occurences etc. as appropriate for your binary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.