Speech synthesis doesn't work in the snap
Categories
(Firefox Build System :: Third Party Packaging, defect, P3)
Tracking
(Not tracked)
People
(Reporter: olivier, Assigned: gerard-majax)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:92.0) Gecko/20100101 Firefox/92.0
Steps to reproduce:
Using the firefox snap, open the devtools console, and enter:
speechSynthesis.speak(new SpeechSynthesisUtterance("Testing 1 2 3"));
Actual results:
Nothing (no text is being spoken).
Expected results:
speech-dispatcher should be speaking "Testing 1 2 3".
This is a snap-specific issue, speech synthesis works well with an unconfined build of firefox. More details at https://forum.snapcraft.io/t/firefox-snap-speech-dispatcher/6165.
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Web Speech' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 2•2 years ago
|
||
original poster notes that this is a snap-specific issue not a speech issue
Comment 3•2 years ago
|
||
The severity field is not set for this bug.
:gerard-majax, could you have a look please?
For more information, please visit auto_nag documentation.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 4•2 years ago
|
||
I was not even able to get speech synthesis to work in non snap firefox either :)
Reporter | ||
Comment 5•2 years ago
|
||
I can confirm it doesn't work for me, neither in the snap nor in the upstream tarball.
Reporter | ||
Comment 6•2 years ago
|
||
For the snap, this thread is relevant.
Reporter | ||
Comment 7•2 years ago
|
||
And a similar issue affecting the chromium snap.
Assignee | ||
Comment 8•2 years ago
|
||
After bug 1666703 is fixed, there are still a few roadblocks:
- we need to add
libspeechd2
as astage-packages
component in the firefox snap - we need to
prime
usr/lib/*/libspeechd.so.*
That is still not enough. By default, communication is done over a socket $XDG_RUNTIME_DIR/speech-dispatcher/speechd.sock
, granting this would need some snapd interface change.
Experimenting further by forcing SPEECHD_ADDRESS=inet_socket
(as well as in the configuration file /etc/speech-dispatcher/speechd.conf
, one still cannot get speechSynthesis.getVoices()
to return more than an empty array. It looks like libspeechd2
somehow handles some auto spawning of the daemon, and I assume this is getting blocked by the Snap-level sandboxing.
This can be bypassed by issuing spd-say -L
aside of a running Firefox, and once you have a process spawn quickly isssuing a speechSynthesis.getVoices()
to connect to it. Once that is done, Speech Synthesis can work.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 9•2 years ago
|
||
Auto spawning seems to simply require the executable to be within the Snap. Ubuntu people suggested we rather rely on socket activation as reported on https://github.com/brailcom/speechd/issues/448. That, in combination with bug 1787245 should be enough.
Reporter | ||
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 10•2 years ago
|
||
According to upstream, some of the problems with socket activation are now fixed. Let's give a new try to this feature.
Assignee | ||
Comment 11•2 years ago
|
||
Nathan or Amin, looks like there has not yet been a release including https://github.com/brailcom/speechd/commit/e7e188f4f118f59f0daa3d53ceece5b3aefcf0d1. Also, we would need this release to be available in core22
and core20
?
Comment 12•2 years ago
|
||
According to upstream, some of the problems with socket activation are now fixed. Let's give a new try to this feature.
Alexander, even with e7e188 in, I couldn't get the socket activation to actually work[1].
Assignee | ||
Comment 13•2 years ago
|
||
Well I was told that it was fixed and pointed to the previous link
Comment 14•2 years ago
|
||
Unfortunately I don't have any more information/context around this than what Nathan already provided.
Comment 15•2 years ago
|
||
I tried https://github.com/brailcom/speechd/commit/4fc86d73a87c9e120489b89b43d4e9423b68df4f and that seems to have solved the problem here!
Comment 16•2 years ago
|
||
For your information, if trying this in a snap, make sure to supply a correct XDG_RUNTIME_DIR as that seems to be modified by snapcraft or snapd.
Namely, in a snap run --shell {snap-name-with-spd}
, this fails:
$ spd-say bye
Failed to connect to Speech Dispatcher:
Error: Can't connect to unix socket /run/user/1000/snap.geheim/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)
but this works:
$ XDG_RUNTIME_DIR=/run/user/1000 spd-say bye
Assignee | ||
Comment 17•1 year ago
|
||
So I had a look and I'm a bit lost on the packaging differences and how it interacts with snap to hack that. Do you have some PPA or something else with an uptodate deb of speech-dispatcher
to build a snap?
Comment 18•1 year ago
•
|
||
I built the patched speech-dispatcher in a PPA[1] and then a snap[2] with spd-say to test
After installing them,
systemctl start --user speech-dispatcher.socket
snap run --shell geheim
$ XDG_RUNTIME_DIR=/run/user/1000 spd-say hi
[1] https://launchpad.net/~nteodosio/+archive/ubuntu/rebuilds/+build/26035882
[2] https://launchpad.net/~nteodosio/+snap/test-speechd/+build/2103550
Assignee | ||
Comment 19•1 year ago
|
||
(In reply to Nathan Teodosio :nteodosio from comment #18)
I built the patched speech-dispatcher in a PPA[1] and then a snap[2] with spd-say to test
After installing them,
systemctl start --user speech-dispatcher.socket
snap run --shell geheim
$ XDG_RUNTIME_DIR=/run/user/1000 spd-say hi[1] https://launchpad.net/~nteodosio/+archive/ubuntu/rebuilds/+build/26035882
[2] https://launchpad.net/~nteodosio/+snap/test-speechd/+build/2103550
Thanks but this is not working for me. I dont see in https://git.launchpad.net/~nteodosio/+git/geheim/tree/snapcraft.yaml where you added your PPA reference.
package-repositories:
- type: apt
ppa: nteodosio/rebuilds
When I do I hit this error E: The repository 'http://ppa.launchpad.net/nteodosio/rebuilds/ubuntu focal Release' does not have a Release file.
which makes sense since the rebuilds
PPA targets mantic
serie.
Comment 20•1 year ago
|
||
(In reply to Alexandre LISSY :gerard-majax from comment #19)
(In reply to Nathan Teodosio :nteodosio from comment #18)
I built the patched speech-dispatcher in a PPA[1] and then a snap[2] with spd-say to test
After installing them,
systemctl start --user speech-dispatcher.socket
snap run --shell geheim
$ XDG_RUNTIME_DIR=/run/user/1000 spd-say hi[1] https://launchpad.net/~nteodosio/+archive/ubuntu/rebuilds/+build/26035882
[2] https://launchpad.net/~nteodosio/+snap/test-speechd/+build/2103550Thanks but this is not working for me. I dont see in https://git.launchpad.net/~nteodosio/+git/geheim/tree/snapcraft.yaml where you added your PPA reference.
package-repositories: - type: apt ppa: nteodosio/rebuilds
When I do I hit this error
E: The repository 'http://ppa.launchpad.net/nteodosio/rebuilds/ubuntu focal Release' does not have a Release file.
which makes sense since therebuilds
PPA targetsmantic
serie.
When you say "it's not working", do you mean that the recipe I proposed is not working, or that you did not attempt it as proposed since you couldn't find the PPA reference in the snapcraft.yaml of the snap?
The PPA doesn't need to be in the snap, only in the host, as in the latter is the socket and the service to be activated via that socket.
Assignee | ||
Comment 21•1 year ago
|
||
I say it's not working because I was assuming I need to use the PPA within the snap build itself, and as stated there's only a mantic
release. I will probably have to rebuild from your ppa anyway because my test VM is running 22.04
.
dont we risk having different versions of speech-dispatcher between host and snap and potential weird bugs? And when you say host
you do refer to the one where we install the snap, not the host used for building, right?
Comment 22•1 year ago
|
||
dont we risk having different versions of speech-dispatcher between host and snap and potential weird bugs?
Since the patch would have to be backported to Jammy first so that Firefox could pick it up (I assume we wouldn't want it's snapcraft.yaml to pick up stuff from a PPA), I thought that a positive result with that proposed test case would be OK, but you do have a fair point.
And when you say host you do refer to the one where we install the snap, not the host used for building, right?
Yes, sorry for the lack of clarity there.
Assignee | ||
Comment 23•1 year ago
|
||
So this will require 0.11.4-2ubuntu1
package (currently in mantic-proposed
, I did rebuild myself for jammy
) to be backported, but I am happy to say it seems to work. Requires a reboot for the systemd socket activation to be active by default, otherwise user needs to systemctl start --user speech-dispatcher.socket
as mentionned earlier.
Assignee | ||
Comment 24•1 year ago
|
||
Assignee | ||
Comment 25•1 year ago
|
||
Assignee | ||
Comment 26•1 year ago
|
||
SRU is under review, PR was merged, we can close this. Reopen if there's a problem and the SRU does not make it ?
Description
•