Speech Dispatcher

repository·master·Indexed 43 days ago

https://github.com/brailcom/speechd

A device-independent abstraction layer for speech synthesis that provides a stable interface between client applications and various Text-to-Speech (TTS) engines. It utilizes a client/server model and the Speech Synthesis Interface Protocol (SSIP) to support a wide range of engines including eSpeak-NG, Festival, and Piper, as well as multiple sound output subsystems like PulseAudio and PipeWire.

Tokens
7K
Snippets
20
Records
44
Agent score
55%

What's inside Speech Dispatcher

  1. Overview of Speech Dispatcher

    master
    Speech Dispatcher provides a high-level, device-independent layer for accessing speech synthesis. It acts as a common interface between client applications and various speech synthesis engines (TTS), allowing developers to write applications that work with any supported synthesizer without needing to handle specific engine implementations.
  2. Develop Speech Synthesis Modules

    master

    Speech synthesis backends can be integrated as modules. The interface between the speechd server and the syntheses is a pipe between processes using a simple protocol. This allows integration of C libraries, external commands, or HTTP services.

    To simplify module development, a libspeechd_module library is provided under a BSD-2 license. For more details, refer to the Output Modules documentation.

  3. Understand the Speech Dispatcher architecture

    master

    Speech Dispatcher operates on a client/server model.

    • Server: Manages concurrent synthesis requests, handles sound output, and resolves conflicts/priorities between incoming requests. It maintains independent state (context switching) for each client connection.
    • Clients: Applications that want to produce speech (e.g., assistive technologies). Clients communicate with the server via a Unix socket or Inet TCP connection using the Speech Synthesis Interface Protocol (SSIP).

    This architecture allows applications to avoid direct device management, concurrent access handling, and complex sound output logic, acting as a high-level abstraction layer for speech synthesis.

  4. Format C code using GNU indent

    master

    To ensure compliance with the Speech Dispatcher coding style, use indent (version 2.2.10 or later) with the following flags. If using a version older than 2.2.10, omit the -il0 flag.

    indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1 -il0
  5. Configure voice and synthesizer settings

    master

    Voice settings can be configured at three levels, with higher levels overriding lower ones:

    1. Client Application (e.g., Orca, speechd-el): Highest priority.
    2. User Level: Settings in ~/.config/speech-dispatcher/spd.conf.
    3. System Level: Settings in /etc/speech-dispatcher/speechd.conf.

    System Configuration

    The system-level file /etc/speech-dispatcher/speechd.conf defines the default:

    • Synthesizer
    • Voice type or symbolic name (e.g., MALE1)
    • Default language
    • Default voice parameters: rate, pitch, pitch range, and volume.

    User Configuration

    Use the spd-conf application to modify settings. spd-conf can set the synthesizer, language, and voice parameters (rate, pitch, etc.), but it cannot select a specific voice directly.

    Selecting a Specific Voice

    To select a specific voice (e.g., 'bob' or 'viginie'), you must do so from the client application. The client selects from a list provided by the chosen synthesizer. Voice names may include locale codes, such as (fr-FR) for French from France.

  6. Import symbols dictionaries

    master

    To import symbols dictionaries into Speech-Dispatcher, follow these steps to gather the necessary source files and run the import process:

    1. Prerequisites:
      • Ensure gettext version 0.20 or later is installed.
      • Install the latest version of orca master manually.
    2. Gather Source Files:
      • NVDA: Download the NVDA sources (e.g., from https://github.com/nvaccess/nvda/archive/beta.zip), extract them, and place them in the locale/symbolsrc/nvda-beta sub-directory.
      • CLDR: Download the latest Unicode CLDR release (cldr-common-<version>.zip) from https://unicode.org/Public/cldr/latest and extract it into locale/symbolsrc/cldr.
      • UnicodeData.txt: Download UnicodeData.txt from ftp://ftp.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt and place it directly in the locale/symbolsrc directory.
    3. Run Import: Navigate to the locale directory and execute the make command:
      make import-symbols
    4. Register New Dictionaries: If new dictionaries are generated, you must register them in the Makefile.am file located in the locale directory. Add the new files to the nobase_localedata_DATA variable using the following syntax (ensure a tab character precedes the entry and maintain alphabetical order):
      lang/file.dic \
    make import-symbols
  7. Coding Style Guidelines for C Code

    master

    All contributions to Speech Dispatcher must follow these C coding standards. The project uses an indentation style similar to the Linux kernel with specific naming conventions:

    Naming Conventions

    • Functions: lowercase words separated by underscores (e.g., my_function_name). Functions that are implementation details within a single source file must be declared as static.
    • Variables:
      • Global variables: Follow function naming conventions (e.g., output_modules).
      • Local variables: Verbosity should be appropriate to the variable's scope.
    • Macros: Uppercase words separated by underscores (e.g., SPEECHD_OPTION_CB_STR).
    • Types: Mixed case (e.g., MessageType).

    Logic

    • goto statements should be avoided unless required by very special cases.
  8. Access Documentation for Speech Dispatcher

    master

    Detailed documentation is available in the doc/ directory or online:

    • Speech Dispatcher Core: doc/speech-dispatcher.html
    • spd-say CLI: doc/spd-say.html
    • SSIP Protocol: doc/ssip.html
    • Python Bindings: Use pydoc3 speechd (or pydoc speechd) on your shell, or view the speechd.client module documentation online.
    • General Overview: See README.overview.md for features, supported engines, and troubleshooting.
  9. Run a local instance of Speech Dispatcher for testing

    master

    If you have built Speech Dispatcher from source and want to test it without installing it (to avoid interfering with an existing instance), you can run the server in a dedicated mode.

    To run the server:

    ./run-speechd -t 0 -s

    To use the spd-say client with this instance in another terminal:

    ./run-spd-say foo

    To make other clients connect to your dedicated instance, export the SPEECHD_ADDRESS environment variable:

    export SPEECHD_ADDRESS=inet_socket:127.0.0.1:6561

    If you also want clients to use the just-built libspeechd library, update your LD_LIBRARY_PATH:

    export LD_LIBRARY_PATH=$PWD/src/api/c/.libs
  10. Overview of the Python interface to SSIP

    master
    This project provides a Python interface to the Speech Dispatcher Simple Interface Protocol (SSIP). It implements the full range of SSIP commands and includes support for callback handling. For detailed technical specifications of the available commands, refer to the "Python API" section in the official Speech Dispatcher documentation.