Speech-dispatcher

From LinuxReviews
Jump to navigationJump to search
Speech-dispatcher
Original author(s)Brailcom
Developer(s)Samuel Thibault
Initial release2002; 18 years ago (2002)
Stable release
0.10.1 / August 9, 2020; 3 months ago (2020-08-09)
Repositorygithub.com /brailcom/speechd/
Operating systemSystemD/Linux
TypeSystem dameon
DocumentationSpeech Dispatcher manual (freebsoft.org/doc)
Manpage: speech-dispatcher.1
DocumentationSpeech Dispatcher manual (freebsoft.org/doc)
Manpage: speech-dispatcher.1
Text-speak.png

Speech-dispatcher is a system daemon that allows programs to use one of the installed speech synthesizer programs to produce audio from text input as long as it has a special module or a configuration file for the speech synthesizer programs you want to use. It sits a a layer between programs that would like to turn text into speech and programs who actually do that.

Features And Usability

Speech dispatcher can't be used for much on it's own. It is meant to be called from programs like KMouth when they need text to speech functionality. You will generally not have to interact with it on your own. You may, from time to time, notice that it has magically appeared in the process list. That's a result of some program asking it to provide text-to-speech functionality.

There is a separate package you can install called speech-dispatcher-utils which contains a tool called spd-say. That tool can me used to make your computer spd-say whatever in a terminal. That program is useful if you want to record some computer-generated statement or test a new speech-dispatcher configuration. It is not generally very useful.

Configuration

Speech-dispatcher can be configured using the configuration file /etc/speech-dispatcher/speechd.conf and "module" specific configuration files in /etc/speech-dispatcher/modules/.

Speech-dispatcher supports the following free software text to speech solutions out-of-the-box:

  • espeak-ng
  • festival
  • flite (festival "light")

It does come with additional modules for non-free text to speech software.

The text to speech program it uses is selected by the DefaultModule setting:

# DefaultModule espeak-ng
DefaultModule flite
# DefaultModule festival
# DefaultModule mimic-generic

There is also a "generic" module available. This "generic" module can be used to create custom "modules" (=configuration files) for any text to speech software, like mimic, which is not supported by a speech-dispatcher C module.

Custom "modules"

Custom module configuration files need nothing more than a GenericExecuteSynth variable with a executable and a command line and a GenericCmdDependency option pointing to the binary.

All you need to make mimic work with speech-dispatcher is:

File: /etc/speech-dispatcher/modules/mimic-generic.conf
GenericExecuteSynth "mimic -voice slt -t \'$DATA\'"
GenericCmdDependency "mimic"

And a line in /etc/speech-dispatcher/speechd.conf that says:

File: /etc/speech-dispatcher/speechd.conf
DefaultModule mimic-generic

You may want to make your custom module slightly more advanced. Generic module configuration files support choosing voices the underlying speech synthesis program supports. Making a module support voices is a matter of adding voices with AddVoice statements and passing a $VOICE variable to the speech engine.

File: /etc/speech-dispatcher/modules/mimic-generic.conf
GenericExecuteSynth "mimic -voice $VOICE -t \'$DATA\'"
GenericCmdDependency "mimic"
AddVoice "en-us" "FEMALE1" "slt"
AddVoice "en-us" "MALE1"   "ab"
AddVoice "en-us" "MALE2"   "awb"
AddVoice "en-us" "MALE3"   "rms"

The default voice is set in /etc/speech-dispatcher/speechd.conf using a DefaultVoiceType statement. Having a DefaultVoiceType statement in a module configuration file makes no difference.

File: /etc/speech-dispatcher/speechd.conf
DefaultVoiceType  "FEMALE1"
DefaultModule mimic-generic

Running the spd-say -L when those AddVoice statements are present makes it list the voices as available:

$spd-say -L
NAME  LANGUAGE  VARIANT
slt   en-us     FEMALE1
ab    en-us     MALE1
awb   en-us     MALE2
rms   en-us     MALE3

The voices spd-say know about can be used by using the -t argument and the variant name in lowcase:

spd-say -t male2  "Hello world"

Will pass awb on to mimic using the $VOICE variable.

You will want to use the $LANGUAGE variable if you make a speech-dispatcher module for some back-end with language-specific voices.

See also

Links

Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.