Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flatpak TTS does not work #1126

Closed
Nitrousoxide opened this issue Nov 14, 2023 · 12 comments
Closed

Flatpak TTS does not work #1126

Nitrousoxide opened this issue Nov 14, 2023 · 12 comments
Labels
bug Something isn't working not our bug Needs to be fixed upstream or elsewhere

Comments

@Nitrousoxide
Copy link

Nitrousoxide commented Nov 14, 2023

Describe the bug
TTS does not work in the flatpak.

To Reproduce
Steps to reproduce the behavior:

  1. Double click on some text to start TTS there
  2. Select "Speak from Here"
  3. Get error stating "Text-to-Speech Error: Make sure Speech Dispatcher is installed and working on your system"

Expected behavior
TTS should start.

Screenshots
image

Version:

  • Foliate version: 3.0.0
  • OS/Distribution and version: Fedora 39
  • Desktop environment: Gnome 45.1
  • Installation method: Flatpak

Additional context
I have speech dispatcher installed (via a distrobox container and exported to ~/.local/bin) on this host but the flatpak container does not pick it up. Though the flatpak should probably have that dependency installed in its own container if it's an actual dep.

❯ which speech-dispatcher
/home/Brian/.local/bin/speech-dispatcher

Documents/Repos/distrobox-assemble 
❯ speech-dispatcher test
[Tue Nov 14 11:02:21 2023 : 109042] speechd: Speech Dispatcher 0.11.5 starting
@Nitrousoxide Nitrousoxide added the bug Something isn't working label Nov 14, 2023
@johnfactotum
Copy link
Owner

It should work if speech-dispatcher is actively running on the host, but it does appear that it can't activate speech-dispatcher automatically if it isn't running.

@fastrizwaan
Copy link

Are there any good human like tts voices who can do tts with foliate?

@fastrizwaan
Copy link

Just found out https:/rhasspy/piper

The voice samples, they are too good
https://rhasspy.github.io/piper-samples/

if we could get it working as a flatpak, that'd be nice.

@fastrizwaan
Copy link

I've installed rpm-ostree install speech-dispatcher-utils and spd-say Hello! does output "hello" audio on fedora 39 silverblue.

but with flatpak foliate even with talkname and full system access, it is throwing error:

here's the error output:

rizvan@fedora:~$ flatpak run --talk-name=org.freedesktop.Flatpak --filesystem=host com.github.johnfactotum.Foliate 


(com.github.johnfactotum.Foliate:2): com.github.johnfactotum.Foliate-CRITICAL **: 02:01:41.528: Error: Error connecting to /run/user/1000/speech-dispatcher/speechd.sock: Gio.IOErrorEnum: Could not connect: Connection refused
connect@resource:///com/github/johnfactotum/Foliate/speech.js:28:19
init@resource:///com/github/johnfactotum/Foliate/speech.js:83:30
send@resource:///com/github/johnfactotum/Foliate/speech.js:114:20
stop@resource:///com/github/johnfactotum/Foliate/speech.js:146:21
#init@resource:///com/github/johnfactotum/Foliate/tts.js:64:21
speak@resource:///com/github/johnfactotum/Foliate/tts.js:79:19
#onSelection@resource:///com/github/johnfactotum/Foliate/book-viewer.js:879:34
selection@resource:///com/github/johnfactotum/Foliate/book-viewer.js:461:53
@resource:///com/github/johnfactotum/Foliate/book-viewer.js:215:23
registerHandler/<@resource:///com/github/johnfactotum/Foliate/webview.js:172:25
_init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34
  
^C

@Nitrousoxide
Copy link
Author

Nitrousoxide commented Nov 15, 2023

I've installed rpm-ostree install speech-dispatcher-utils and spd-say Hello! does output "hello" audio on fedora 39 silverblue.

but with flatpak foliate even with talkname and full system access, it is throwing error:

Just to test this some more.
I gave spd-say a long bit of text to speak out and while it was still speaking started foliate's TTS.

 spd-say Hello, this is a test to see how well things are working.  Id like to see how long they will continue to talk

It did successfully speak. I've not added/removed any permissions for foliate's flatpak. I would note there are no controls for TTS though, so once you start it you can't stop it unless you back out of the book entirely.

I assume it is trying to tap into the speechd.sock which only temporarily exists while an ongoing speech command is running.

If you try to start tts in foliate without first starting spd-say in a terminal with some text line you get this (on fedora 39 workstation)

❯ flatpak run com.github.johnfactotum.Foliate

(com.github.johnfactotum.Foliate:2): com.github.johnfactotum.Foliate-WARNING **: 17:28:46.322: Gio.IOErrorEnum: Access to service is disallowed 'SERVICE'
getURIFromTracker@resource:///com/github/johnfactotum/Foliate/library.js:30:30
get@resource:///com/github/johnfactotum/Foliate/library.js:56:42
getBookFromIdentifier@resource:///com/github/johnfactotum/Foliate/library.js:105:36
getBook@resource:///com/github/johnfactotum/Foliate/library.js:101:21
activate@resource:///com/github/johnfactotum/Foliate/library.js:394:63
activate@resource:///com/github/johnfactotum/Foliate/library.js:322:18
_init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34

@johnfactotum
Copy link
Owner

I gave spd-say a long bit of text to speak out

You can use spd-say -e to keep the server running without speaking.

I assume it is trying to tap into the speechd.sock which only temporarily exists while an ongoing speech command is running.

In older versions of speech-dispatcher, yes. But it supports socket activation starting from 0.11.4.

The Ubuntu package for speech-dispatcher installs a /usr/lib/systemd/user/speech-dispatcher.socket (see https://packages.ubuntu.com/mantic/amd64/speech-dispatcher/filelist). I just tried the Snap version on Ubuntu (which has strict confinement, so as with Flatpak it can't directly spawn speech-dispatcher), and TTS works.

But the packages for Debian (https://packages.debian.org/bookworm/amd64/speech-dispatcher/filelist) and Arch Linux (https://archlinux.org/packages/extra/x86_64/speech-dispatcher/files/) don't install this file. Presumably this is the case on Fedora as well.

If you try to start tts in foliate without first starting spd-say in a terminal with some text line you get this

No, that warning is about Tracker. I think it happens if you don't have tracker-miners installed. SERVICE here refers to dbus:org.freedesktop.Tracker3.Miner.Files.

@johnfactotum
Copy link
Owner

Just tried the Flatpak on Ubuntu, and it seems to be working.

@johnfactotum
Copy link
Owner

Added a section in troubleshooting with an explanation and a workaround for this issue: https:/johnfactotum/foliate/blob/gtk4/docs/troubleshooting.md#text-to-speech-doesnt-work

@johnfactotum johnfactotum added the not our bug Needs to be fixed upstream or elsewhere label Nov 17, 2023
@fastrizwaan
Copy link

Thank you, starting speech-dispatcher --timeout 0 in a terminal then asking foliate to play works.

I'm really thankful for such a wonderful ebook reader, and you've really done a great job with foliate.

Do you by any chance know how to change the speech-dispatcher to use "piper" voices which are really good. the robotic voice is not so cool you know.

@johnfactotum
Copy link
Owner

Do you by any chance know how to change the speech-dispatcher to use "piper" voices which are really good.

See brailcom/speechd#866

@johnfactotum johnfactotum closed this as not planned Won't fix, can't repro, duplicate, stale Nov 20, 2023
@qoijjj
Copy link

qoijjj commented Mar 2, 2024

Thank you, starting speech-dispatcher --timeout 0 in a terminal then asking foliate to play works.

I'm really thankful for such a wonderful ebook reader, and you've really done a great job with foliate.

Do you by any chance know how to change the speech-dispatcher to use "piper" voices which are really good. the robotic voice is not so cool you know.

Posting this here as well

https:/Elleo/pied

@fastrizwaan
Copy link

@qoijjj thank you so much, I've installed voices using pied. they work.

in a terminal speech-dispatcher --timeout 0 start foliate and select text and choose 'Speak from Here'

@johnfactotum could you integrate or suggest users to use pied to get great voices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working not our bug Needs to be fixed upstream or elsewhere
Projects
None yet
Development

No branches or pull requests

4 participants