Speech Dispatcher module

sd_dengjen is a Speech Dispatcher output module. Applications that speak through Speech Dispatcher (spd-say, screen readers such as Orca) can use any installed Piper voice, including the Kurmanji voice. The module runs as a separate process, so nothing links against Speech Dispatcher.

It has been run against a real speech-dispatcher server with spd-say, the Python client and Orca. The Orca run was headless: Orca spoke through the module, echoed typed characters and interrupted speech cleanly. A second headless run moved the caret with the arrow keys and typed keys: Orca asked the server for the line, character and key-echo messages, and the module stayed up through the interrupts between them. That run used emulated CPU instructions, so it does not show the speech timing.

Install

Debian and Ubuntu package

Release pages attach dengjen-speechd_<version>-1_amd64.deb and dengjen-speechd_<version>-1_arm64.deb. The package installs the module with its own espeak-ng-data. Speech Dispatcher finds it on its own, so no configuration is needed:

sudo apt install ./dengjen-speechd_<version>-1_amd64.deb

Install a voice with dengjen voices install ku_TR-berfin_renas-medium (the dengjen package), then restart Speech Dispatcher and run the checks below.

Without root, on any distribution

scripts/install-speechd-user.sh installs the module and the dengjen voice manager for the current user only. It downloads the latest release’s .deb files and unpacks them into the home directory instead of installing them, so it also works on distributions that do not use .deb packages:

curl -fsSLO https://raw.githubusercontent.com/ZirekHQ/dengjen/main/scripts/install-speechd-user.sh
bash install-speechd-user.sh

It writes:

  • ~/.local/libexec/speech-dispatcher-modules/sd_dengjen and its espeak-ng-data, where Speech Dispatcher looks for a user’s own modules ($XDG_DATA_HOME/../libexec, so the script follows XDG_DATA_HOME too)

  • ~/.config/speech-dispatcher/modules/dengjen.conf

  • ~/.local/lib/dengjen/, linked from ~/.local/bin/dengjen

It then installs the Kurmanji voice ku_TR-berfin_renas-medium. Pass --voice <key> for another voice, --no-voice to skip it, --version X.Y.Z for an older release, or --deb-dir <dir> to use .deb files you already downloaded. --uninstall removes everything except the voices.

Restart Speech Dispatcher afterwards with pkill -f speech-dispatcher; the next request starts it again. (pkill -x speech-dispatcher matches nothing, because the process name is cut to 15 characters.) -f matches any process whose command line contains the text, including a script named after Speech Dispatcher. In a script, use pkill -x speech-dispatch, which matches the process name cut to 15 characters instead of the whole command line. A script whose own file name starts with speech-dispatch gets that process name too, so give the script another name. Restart Orca too, so it reconnects.

The script needs curl or wget, and dpkg-deb, bsdtar, or ar with xz to unpack. The release builds are for x86_64 and arm64 with glibc 2.39 or newer (Ubuntu 24.04’s).

Flatpak

There is no Flatpak. Speech Dispatcher has no extension point for output modules, and the host server starts each module itself, so a sandboxed module cannot register with it. Use the package or build from source.

From source

Build the module and install a voice:

cargo build --release -p dengjen-speechd
dengjen voices install ku_TR-berfin_renas-medium

Copy the binary into the module directory and give it a configuration file. These paths are Debian and Ubuntu’s; other distributions use their own libexec/speech-dispatcher-modules directory, and Speech Dispatcher also searches ~/.local/libexec/speech-dispatcher-modules.

sudo install -m 755 target/release/sd_dengjen /usr/lib/speech-dispatcher-modules/
printf '# sd_dengjen has no module options.\n' | sudo tee /etc/speech-dispatcher/modules/dengjen.conf

Restart Speech Dispatcher.

Speech Dispatcher detects the module from the binary and its configuration file, and keeps loading the other installed modules such as espeak-ng. Do not add an AddModule line unless your speechd.conf already lists modules explicitly: the first AddModule line turns detection off, and then only the listed modules load. If it does list them, add AddModule "dengjen" "sd_dengjen" "dengjen.conf" next to them.

Check the install

The module and voice should be visible:

spd-say -O                          # lists dengjen
spd-say -o dengjen -L               # lists the installed voices
spd-say -o dengjen -l ku "Silav"

Use it with Orca

Orca speaks through Speech Dispatcher, so it can use the module once spd-say -O lists dengjen. Restart Orca after installing the module or a voice so it reloads the list of synthesizers.

  1. Open Orca’s preferences with Orca+Space (Insert+Space on the desktop layout, Caps Lock+Space on the laptop layout).

  2. On the Voice page, set Speech system to Speech Dispatcher and Speech synthesizer to dengjen.

  3. Set Language to Kurmanji (ku), then pick the Kurmanji voice in Person. Person lists only the voices for the chosen language. Orca otherwise asks for language C, which falls back to the first installed voice, so this matters once more than one voice is installed.

  4. Press Apply, then OK. Orca should now read its own interface in Kurmanji.

Check it

Run these checks after a new install, and after any change to the module. Each one names what to listen for.

Check What should happen

Read a Kurmanji web page in Firefox with the arrow keys, then with say all (Numpad Plus, or Orca+Semicolon on the laptop layout)

Every line is spoken in Kurmanji, sentence by sentence, without gaps or repeated sentences.

Move around a GTK app, such as GNOME Text Editor or Settings, with Tab and the arrow keys

Each focused control and each line is spoken. Typed characters are echoed.

Press Ctrl, or any other key, while Orca is reading a long paragraph

Speech stops within one sentence, and the next thing Orca says starts at once.

Change Rate and Pitch in Orca’s voice settings, then press Apply

Speech gets faster or slower, and higher or lower. The middle of each slider is the voice’s normal speed and pitch.

Before this check, keep another way to use the computer at hand, such as a braille display or a second session with another voice, because Orca goes silent. Remove the voice (dengjen voices remove ku_TR-berfin_renas-medium, or ~/.local/bin/dengjen …​ after a user-local install) and any other Dengjen voices, then restart Speech Dispatcher (pkill -f speech-dispatcher) and Orca. Install the voice again with dengjen voices install ku_TR-berfin_renas-medium.

While no voice is installed, Orca keeps running and responds to keys but says nothing, and the module’s log names the command that installs a voice. Once the voice is back, the next thing Orca says is spoken, with no restart. Packages from release 3.1.0 and older do not start with no voice installed, so run this check with a newer release.

If a check fails, open an issue with the check, your distribution and its version, the output of spd-say -O and spd-say -o dengjen -L, and the module’s log, dengjen.log (see Where the module’s log is).

Where the module’s log is

Speech Dispatcher writes it to speech-dispatcher/log/dengjen.log under the user runtime directory: $XDG_RUNTIME_DIR, usually /run/user/<your user id>/ in a desktop session. When XDG_RUNTIME_DIR is not set, it uses the cache directory instead: $XDG_CACHE_HOME, or ~/.cache when that is not set either. The server’s own speech-dispatcher.log in the same folder names the file on its "Output module is logging to file" line.

Voices

The module reads voices from ~/.local/share/dengjen/voices, the same directory dengjen voices installs into. Speech Dispatcher starts the module, so DENGJEN_VOICES_DIR only takes effect when it is set in the server’s environment.

A request picks the voice by name (synthesis_voice), then by language (ku matches ku_TR-berfin_renas-medium), then falls back to the first installed voice in sorted key order.

The module starts even when no voice is installed. Every request looks at the voices directory again, so a voice installed later works at once, without restarting Speech Dispatcher. Until then each request is reported as stopped without audio, and the module’s log (see Where the module’s log is) names the command that installs a voice: dengjen voices install ku_TR-berfin_renas-medium, or ~/.local/bin/dengjen voices install …​ after a user-local install when ~/.local/bin is not on your PATH.

Orca requests language C, so it gets that fallback voice. With several voices installed, pick the Kurmanji one in Orca’s voice settings.

The Kurmanji voice needs no eSpeak data. A voice that phonemizes with eSpeak-ng finds espeak-ng-data next to the module binary, or in the directory named by DENGJEN_ESPEAKNG_DATA_DIRECTORY.

Settings

Rate, pitch and volume use Speech Dispatcher’s -100 to 100 scale. Rate and pitch 0 are the voice’s normal speed and pitch. Volume 0 is full volume; negative values make it quieter.

Behaviour

  • Audio goes back through the server (audio_output_method=server), so the server’s audio output settings decide where it plays.

  • The module reads sentences one at a time and reports an index mark after each. STOP and QUIT end the speech within one sentence. PAUSE stops it, and the server resumes from the last sentence played.

  • Sound icons are spoken by name; the module plays no icon audio.

  • When synthesis cannot start, the module reports the speech as begun and then stopped. Speech Dispatcher drops a message the module refuses without telling the client, so a client that waits for the end, such as spd-say -w, would otherwise wait forever.