Firefox snap & speech-dispatcher

Hello there!

I’ve tried a few Text-To-Speech demos to find out speech-dispatcher is not supported in the snapped Firefox.
Are there plans regarding speech-dispatcher in Firefox?
This sounds like an opportunity to discuss further handling of TTS as I’m starting to think a dedicated interface for speech-dispatcher may sound reasonable.

Greetings

1 Like

@willcooke - fyi, here is another one for the firefox snap maintainer.

Has there been some activity around speech-dispatcher in Firefox?
Since the snap is the prefered package shown in GNOME Software I have concerns around missing a11y support.

Sorry for the lack of reply so far @beidl, this thread somehow went under my radar.
I’m not familiar with what’s required for text-to-speech to work, but I can confirm that this doesn’t work in the firefox snap (nor in the chromium snap). I tested with http://blog.teamtreehouse.com/getting-started-speech-synthesis-api, and the combo box that should contain a list of languages is empty, so I’m guessing confinement prevents the application from querying the system for available languages. I couldn’t observe any relevant denials though.

The snaps would need to include libspeechd2 in their stage packages, and we would indeed need a dedicated interface as speech-dispatcher appears to use a unix socket ($XDG_RUNTIME_DIR/speech-dispatcher/speechd.sock) for communication.

I have quickly rebuilt the chromium snap with those two changes but that doesn’t appear to be enough, this will require further investigation. I’m putting the task in my backlog.

1 Like

Thanks for the input, @oSoMoN, pretty much what I assumed.
I’ve tried to come up with a patch for snapd itself to add the required interface, a draft-ish gist is available here: https://gist.github.com/beidl/81c32310e0be83f8478cd470fa9b35f8

A sample application snap is available here, only using the speech-dispatcher plug:

It’s not much and doesn’t seem to be enough for full support as spd-say within the example snap tries to connect to the socket at $XDG_RUNTIME_DIR/snap.$SNAP/speech-dispatcher/speechd.sock instead of $XDG_RUNTIME_DIR/speech-dispatcher/speechd.sock,
which would’ve been fine if the snap.$SNAP subdirectory existed with a symlink pointing to the actual speechd socket (which seems to be the default behaviour with wayland plug-consuming snaps).

Manually creating directory + speechd.sock symlink results in a connection failure when starting spd-say (probably due to AppArmor denial or missing directory in the snaps namespace).

1 Like

What does that denial look like?

Here’s the output with the mentioned speech-dispatcher example snap:

$ speech-dispatcher-example-snap.spd-say "some text"
Failed to connect to Speech Dispatcher:
Error: Can't connect to unix socket /run/user/1000/snap.speech-dispatcher-example-snap/speech-dispatcher/speechd.sock: No such file or directory. Autospawn: Autospawn failed. Spawn error 8: Failed to execute child process "/usr/bin/speech-dispatcher" (No such file or directory)

This is due to /run/user/1000/snap.speech-dispatcher-example-snap itself missing, the socket would probably map over fine.

It appears application snaps could ship their own speech-dispatcher daemon with the app but this would result in concurring TTS operations unable to properly demux the output.

Update: I have filed an upstream bug to track and hopefully resolve the issue.

1 Like

Today I went to my bank’s website and saw a message I’ve never seen before in Firefox saying “You can’t use speech synthesis because the Speech Dispatcher library is missing.”

I already had speech-dispatcher installed via apt, but apparently it’s not also in the snap (or there’s no connector to the apt version).

I see the upstream bug was marked Resolved + Fixed on June 23rd.

What else do I need to do on my system to activate speech synthesis in the snap version of Firefox so I can learn what my bank wants to “tell” me? :slight_smile:

EDIT: I finally read to the bottom of the page linked from the Firefox message and it says I need Speech Dispatcher 0.11.4.

$ spd-say -v
spd-say 0.11.1
Copyright (C) 2002-2012 Brailcom, o.p.s.
...

On this particular machine I’m running Ubuntu 22.04, so I’ll try it on a newer Ubuntu and see what happens

1 Like

I tried it on Ubuntu 23.04 “Lunar” and the behavior was the same, with Speech Dispatcher version 0.11.4-2ubuntu0.1 – and it looks like that will be the same version in 23.10 “Mantic.”

This still persists in Jammy with the latest version of firefox stable :slightly_frowning_face:

This thing has been fixed and speech dispatcher works perfectly. This bug filed here should be the solution. For others to test, open inspector in firefox and paste this in console.

speechSynthesis.speak(new SpeechSynthesisUtterance("Testing 1 2 3"));

NB. Speech Dispatcher needs to be installed.

I am replying to soumyaDghosh’s message to affirm that yes, now speechSynthesis seems to be working in Firefox (I’m now using the 119.0 snap version) and my (already installed via apt) speech synthesis is STILL version 0.11.1, confirmed with

$ spd-say -v

CLARIFICATION: I just checked apt and I have speech-dispatcher version 0.11.1-1ubuntu3, installed from jammy-updates. packages.ubuntu.com says that update was dated May 2023.

INTERESTINGLY, the bank website no longer causes Firefox to put up an error message, but the site has not yet spoken anything. I’m guessing the CSS or something tests for the presence of speechd and Firefox no longer throws an error.

Installed speech-dispatcher and followed https://support.mozilla.org/en-US/kb/speechd-setup?as=u&utm_source=inproduct but still get the error atleast on my xubuntu 22.04.3 installation, just saying nevertheless.