4

I've got some problems with the recognition of my audio devices (see here for more detail). One suggested fix that floats around the internet is to disable the speech-dispatcher, by changing the following line in the configuration file /etc/default/speech-dispatcher

RUN=yes

to

RUN=no

However, the file /etc/default/speech-dispatcher does not exist on my Ubuntu 20.04. I tried creating it with the proposed line, but I didn't recognize any different behaviour, I was able to use the speech dispatcher with spd-say.

How do I check if adding the configuration file with RUN=no has any effect? And if it does not work this way in Ubuntu 20.04, how can I disable the autostart of speech-dispatcher?

Any help would be appreciated :)

red_trumpet
  • 1,849
  • It is most unlikely that speech-dispatcher will prevent your audio devices from being recognized. I would suggest you try this first. If that doesn't solve it, please add more details to your question about the problem with your audio. – Raffa Mar 29 '21 at 21:02

5 Answers5

6

After many different fixes, some that messed up audio after suspend I found that it was Firefox calling it I disabled speech-dispatcher in "about:config" and no more problem. The #1 answer will work, but I think it's better to stop it at the source.

Edit with instructions

The instructions below are valid as of 2023-09-12 on Fierefox version 117.0

  1. Open a new Firefox tab and go to about:config, and press on Accept risk and continue.
  2. Search for media.webspeech.synth.enabled and disable it.
  3. Log out and log back in. The issue should be resolved.
Gabe
  • 45
Jeff Larson
  • 61
  • 1
  • 1
3

Have you tried to uncomment the DisableAutoSpawn line in the file /etc/speech-dispatcher/speechd.conf, thus the server will not start automatically on requests from the clients ?

It looks like the speech-dispatcher service is not a system service started systematically like other SysV/systemd service, but launched on demand with your UID.

0

Speech Dispatcher will be idle usually.

Disabling the Accessibility - Screen Reader would stop Firefox (or any other) calling the Speech Dispatcher.

0

Background

There are a few answers floating around on how to disable speech dispatcher. I tried a few without success. Since I was in the process of writing a music player and constantly seeing speech-dispatcher as a sound source during testing it was annoying.

Below is a bash solution using the console and a python solution using a GUI.

From the Console

Enter these commands in the console after the $ prompt. The # hashtag comments are not entered.

$ uptime
 17:37:18 up 18 min,  1 user,  load average: 1.63, 1.67, 1.41
# Had rebooted three times: soft, warm and cold.
# The unwanted jobs didn't appear until 18 minutes after
# cold boot.

$ ps aux | grep speech rick 8919 0.0 0.0 289032 5000 ? Sl 17:33 0:00 /usr/lib/speech-dispatcher-modules/sd_dummy /etc/speech-dispatcher/modules/dummy.conf rick 8922 0.0 0.0 326656 7468 ? Sl 17:33 0:00 /usr/lib/speech-dispatcher-modules/sd_espeak /etc/speech-dispatcher/modules/espeak.conf rick 8927 0.0 0.0 289044 5028 ? Sl 17:33 0:00 /usr/lib/speech-dispatcher-modules/sd_generic /etc/speech-dispatcher/modules/generic.conf rick 8930 0.0 0.0 289032 5032 ? Sl 17:33 0:00 /usr/lib/speech-dispatcher-modules/sd_cicero /etc/speech-dispatcher/modules/cicero.conf rick 8934 0.0 0.0 98768 2380 ? Ssl 17:33 0:00 /usr/bin/speech-dispatcher --spawn --communication-method unix_socket --socket-path /run/user/1000/speech-dispatcher/speechd.sock rick 17823 0.0 0.0 15776 928 pts/22 S+ 17:37 0:00 grep --color=auto speech

# Above are four unwanted sound sinks and controller

$ pgrep -f speech-dispatcher/modules 8919 8922 8927 8930

# pgrep shows just the unwanted sound sinks' PID

$ pkill -f speech-dispatcher/modules

# pkill nukes the unwanted sound sinks by PID

$ ps aux | grep speech rick 8934 0.0 0.0 98768 2380 ? Ssl 17:33 0:00 /usr/bin/speech-dispatcher --spawn --communication-method unix_socket --socket-path /run/user/1000/speech-dispatcher/speechd.sock rick 26836 0.0 0.0 15776 996 pts/22 S+ 17:41 0:00 grep --color=auto speech

# Running ps again shows success

You can put two commands above into a bash script:

pgrep -f speech-dispatcher/modules
pkill -f speech-dispatcher/modules

The two line bash script that will delete the sound sinks for you.


Over-killing the PID Killing

The current project is a music player in Python so why not have it check when the speech-dispatcher gremlins show up? Then it displays a message:

check speech dispatcher message.png

Here's the python code to serve as a guide:

def check_speech_dispatcher(self):
    """ Four annoying speech dispatchers appear in Ubuntu """
    if not DELETE_SPEECH:
        return  # Already done or don't want to kill pids
found_pids = list()
for Sink in pav.sinks_now:
    if Sink.name == "speech-dispatcher":
        found_pids.append(Sink.pid)

if len(found_pids) == 0:
    return

global DELETE_SPEECH
DELETE_SPEECH = False  # Don't show message again this session

title = "Speech Dispatcher Jobs Discovered."
text = str(len(found_pids)) + " instance(s) of Speech"
text += "Dispatcher have been found.\n\n"
text += "Do you want to cancel the job(s)?\n"  # centered: \t breaks
answer = message.AskQuestion(self.play_top, title, text, 'no',
                             thread=self.get_refresh_thread())
text += "\n\t\tAnswer was: " + answer.result
self.info.cast(title + "\n\n" + text)

if answer.result != 'yes':
    return  # Don't delete pids
for pid in found_pids:
    ext.kill_pid_running(pid)

Near the bottom is info.cast() function. It zooms down a broadcast message. It's kind of like print() command for a GUI application:

check speech dispatcher info.cast()

0

In my case, pulseaudio might be the culprit that calls speech-dispatcher, not Firefox. I'd followed the suggestion to set Firefox's media.webspeech.synth.enabled to "false" but the problem persisted. However, killing the pulseaudio process was followed by a disappearance of speech-dispatcher.

bernie
  • 1