brailcom / speechd

Common high-level interface to speech synthesis
GNU General Public License v2.0
226 stars 65 forks source link

espeak-ng not set to default speech synthesis engine #813

Closed guest271314 closed 1 year ago

guest271314 commented 1 year ago

Steps to reproduce

Install espeak-ng. spd-conf -u, set espeak-ng as default speech synthesis engine.

Obtained behavior

spd-say -) lists espeak-ng-mbrola. I never installed espeak-ng-mbrola that I am aware of.

Expected behavior

speech-dispatcher to work as it used to.

Behavior information

Please follow the next step, to provide us with precious information about how things went wrong on your machine:

[Fri Apr 7 21:34:50 2023 : 166111] speechd: Error: Module reported error in request from speechd (code 3xx): 300-Opening sound device failed. Reason: Cannot open plugin pulse. error: file not found. 300 MODULE ERROR . [Fri Apr 7 21:34:50 2023 : 166133] speechd: ERROR: Can't initialize audio in output module, see reason above. [Fri Apr 7 21:34:50 2023 : 166224] speechd: Speech Dispatcher Logging to file /run/user/999/speech-dispatcher/log//speech-dispatcher.log [Fri Apr 7 21:34:50 2023 : 166263] speechd: Error [speechd.c:672]:No speech output modules were loaded - aborting...

Distribution

Xubuntu 22.04

Version of Speech-dispatcher

speech-dispatcher 0.11.1

I also tried building speech-dispatcher from this repository. Different error, still no voices.

I initially observed this testing window.speechSynthesis.speak().

sthibaul commented 1 year ago

I see, spd-conf was not able to set DefaultModule because of a mere missing space.

You can fix your configuration by editing .config/speech-dispatcher/speechd.conf, finding the line where DefaultModule is set, and drop the # character that is at the beginning of it.

guest271314 commented 1 year ago

That is one part of the issue. The other part is speech-dispatcher does not want to autospawn. So where I would normally see speech-dispatcher-espeak-ng in Pulse Audio controls persistently it ain't there at all, so no sounf is output when I use speechSynthesis.speak().

sthibaul commented 1 year ago

The other part is speech-dispatcher does not want to autospawn

We'd need the real full logs to determine what is happening.

guest271314 commented 1 year ago

speech-dispatcher.log

sthibaul commented 1 year ago
[Sat Apr  8 08:38:54 2023 : 973935] speechd: Exec of module "/usr/local/libexec/speech-dispatcher-modules/sd_espeak-ng" with config "/home/xubuntu/.config/speech-dispatcher/modules/espeak-ng.conf" failed with error 2: No such file or directory

That's odd, it seems it's getting configuration files wrongly. Could you increase LogLevel to 5 in speechd.conf and retry, so we get to know how things are going exactly?

guest271314 commented 1 year ago

Alright, I set LogLevel to 5 in ~/.config/speech-dispatcher/speechd.conf and ran speech-dispatcher restart. What should I do now?

sthibaul commented 1 year ago

well, try again to trigger auto-spawn? And post the resulting log file

guest271314 commented 1 year ago

I just ran speech-dispatcher -a and speech-dispatcher-espeak-ng is not showing up in Pulse Audio audio mixer (pavu). I've uninstalled

sudo apt --purge remove python3-speechd speech-dispatcher-espeak-ng espeak-ng

and reinstalled

sudo apt install remove python3-speechd speech-dispatcher-espeak-ng espeak-ng

and built speechd from a downloaded tarball of this repository. I am ready to start from scratch again if that what is needed.

I'm just conveying to you something is a foot. speech-dispatcher used to just work for speech synthesis interface to Web Speech API.

guest271314 commented 1 year ago
$ speech-dispatcher -a
[Sat Apr  8 09:18:51 2023 : 105594] speechd: Speech Dispatcher 0.11.4 starting

$ spd-say test
Failed to connect to Speech Dispatcher:
Error: Can't connect to unix socket /run/user/999/speech-dispatcher/speechd.sock: Connection refused. Autospawn: Autospawn failed. Speech Dispatcher refused to start with error code, stating this as a reason: 
guest271314 commented 1 year ago
[Sat Apr  8 09:18:51 2023 : 106717] speechd:    Reading configuration for pattern emacs:*
[Sat Apr  8 09:18:51 2023 : 106768] speechd:  Configuration has been read from "/home/xubuntu/.config/speech-dispatcher/speechd.conf"
[Sat Apr  8 09:18:51 2023 : 106844] speechd:  Initializing output module espeak-ng with binary /usr/local/libexec/speech-dispatcher-modules/sd_espeak-ng and configuration /home/xubuntu/.config/speech-dispatcher/modules/espeak-ng.conf
[Sat Apr  8 09:18:51 2023 : 106865] speechd:   Output module is logging to file /run/user/999/speech-dispatcher/log//espeak-ng.log
[Sat Apr  8 09:18:51 2023 : 107391] speechd:  Module espeak-ng loaded.
[Sat Apr  8 09:18:51 2023 : 107431] speechd:    Trying to initialize espeak-ng.
[Sat Apr  8 09:18:51 2023 : 107460] speechd:     Command sent to output module: |INIT
| (0)
[Sat Apr  8 09:18:51 2023 : 107488] speechd: Exec of module "/usr/local/libexec/speech-dispatcher-modules/sd_espeak-ng" with config "/home/xubuntu/.config/speech-dispatcher/modules/espeak-ng.conf" failed with error 2: No such file or directory
[Sat Apr  8 09:18:51 2023 : 107955] speechd: ERROR: Bad syntax from output module espeak-ng 1
[Sat Apr  8 09:18:51 2023 : 108054] speechd:   Speech Dispatcher Logging to file /run/user/999/speech-dispatcher/log//speech-dispatcher.log
[Sat Apr  8 09:18:51 2023 : 108077] speechd: Error [speechd.c:672]:No speech output modules were loaded - aborting...
[Sat Apr  8 09:31:50 2023 : 203742] speechd:   Speech Dispatcher Logging to file /run/user/999/speech-dispatcher/log//speech-dispatcher.log
[Sat Apr  8 09:31:50 2023 : 203853] speechd:     Will load symbol file gender-neutral.dic
[Sat Apr  8 09:31:50 2023 : 203875] speechd:     Will load symbol file font-variants.dic
[Sat Apr  8 09:31:50 2023 : 203897] speechd:     Will load symbol file symbols.dic
[Sat Apr  8 09:31:50 2023 : 203920] speechd:     Will load symbol file emojis.dic
[Sat Apr  8 09:31:50 2023 : 203942] speechd:     Will load symbol file orca.dic
[Sat Apr  8 09:31:50 2023 : 203963] speechd:     Will load symbol file orca-chars.dic
[Sat Apr  8 09:31:50 2023 : 204010] speechd:     Module name=espeak-ng being inserted into requested_modules list, with 'sd_espeak-ng' 'espeak-ng.conf' '/run/user/999/speech-dispatcher/log//espeak-ng.log' '(null)' '(null)'
[Sat Apr  8 09:31:50 2023 : 204162] speechd:    Reading configuration for pattern emacs:*
[Sat Apr  8 09:31:50 2023 : 204213] speechd:  Configuration has been read from "/home/xubuntu/.config/speech-dispatcher/speechd.conf"
[Sat Apr  8 09:31:50 2023 : 204293] speechd:  Initializing output module espeak-ng with binary /usr/local/libexec/speech-dispatcher-modules/sd_espeak-ng and configuration /home/xubuntu/.config/speech-dispatcher/modules/espeak-ng.conf
[Sat Apr  8 09:31:50 2023 : 204313] speechd:   Output module is logging to file /run/user/999/speech-dispatcher/log//espeak-ng.log
[Sat Apr  8 09:31:50 2023 : 204841] speechd:  Module espeak-ng loaded.
[Sat Apr  8 09:31:50 2023 : 204885] speechd:    Trying to initialize espeak-ng.
[Sat Apr  8 09:31:50 2023 : 204914] speechd:     Command sent to output module: |INIT
| (0)
[Sat Apr  8 09:31:50 2023 : 204964] speechd: Exec of module "/usr/local/libexec/speech-dispatcher-modules/sd_espeak-ng" with config "/home/xubuntu/.config/speech-dispatcher/modules/espeak-ng.conf" failed with error 2: No such file or directory
[Sat Apr  8 09:31:50 2023 : 205465] speechd: ERROR: Bad syntax from output module espeak-ng 1
[Sat Apr  8 09:31:50 2023 : 205558] speechd:   Speech Dispatcher Logging to file /run/user/999/speech-dispatcher/log//speech-dispatcher.log
[Sat Apr  8 09:31:50 2023 : 205586] speechd: Error [speechd.c:672]:No speech output modules were loaded - aborting...
sthibaul commented 1 year ago

Could you also post your /home/xubuntu/.config/speech-dispatcher/speechd.conf?

guest271314 commented 1 year ago

speechd.conf.zip

sthibaul commented 1 year ago

I really don't understand why it's trying to open the configuration file from your user directory...

Could you try with the latest master and post the resulting log file?

guest271314 commented 1 year ago

Could you try with the latest master and post the resulting log file?

You mean building speech-dispatcher?

How do I make sure I get rid of all speech-dispatcher artifacts on the system?

It looks like the program is having issues autospawning.

sthibaul commented 1 year ago

You mean building speech-dispatcher?

Yes.

How do I make sure I get rid of all speech-dispatcher artifacts on the system?

You can for instance uninstall the system package

It looks like the program is having issues autospawning.

It's not the autospawn the problem, but the start of speech-dispatcher itself:

No speech output modules were loaded - aborting...
guest271314 commented 1 year ago

Will your speech-dispatcher-0.11.4 unarchived work for the build? Any flags I need to pass to configure of make?

sthibaul commented 1 year ago

Will your speech-dispatcher-0.11.4 unarchived work for the build?

I don't understand this.

Any flags I need to pass to configure of make?

Default parameters should be just fine (otherwise it would be a bug...)

guest271314 commented 1 year ago

Is there any reason ./configure --with-espeak-ng says it can't find espeak-ng even though the package is installed?

checking for espeak_Synth in -lespeak... no
checking for espeak-ng... no
configure: error: in `/home/xubuntu/Downloads/speech-dispatcher-0.11.4':
configure: error: espeak-ng is not available
See `config.log' for more details
sthibaul commented 1 year ago

See `config.log' for more details

guest271314 commented 1 year ago
configure:22972: checking for espeak-ng
configure:22979: $PKG_CONFIG --exists --print-errors "espeak-ng"
Package espeak-ng was not found in the pkg-config search path.
Perhaps you should add the directory containing `espeak-ng.pc'
to the PKG_CONFIG_PATH environment variable
No package 'espeak-ng' found

Not sure how that is possible. espeak-ng is right there in /usr/bin

Compiled

$ spd-say -O OUTPUT MODULES



How do I set `espeak-ng` as the default output module?
guest271314 commented 1 year ago

Interesting

$ spd-conf -u
Traceback (most recent call last):
  File "/usr/local/bin/spd-conf", line 22, in <module>
    import speechd_config
ModuleNotFoundError: No module named 'speechd_config'
sthibaul commented 1 year ago

Not sure how that is possible. espeak-ng is right there in /usr/bin

It's not looking for the espeak-ng program, but for the espeak-ng library, necessary to be able to build the espeak-ng sd module at all. You needs to install the development package of espeak-ng, something like libespeak-ng-dev.

ModuleNotFoundError: No module named 'speechd_config'

Your distribution is probably missing adding /usr/local/lib/python3.11/site-packages to your PYTHONPATH

guest271314 commented 1 year ago

WHy is all of this happening all of a sudden? Not that long ago I could just install python3-speechd, espeak-ng with apt, run spd-conf -u and be done with the matter.

guest271314 commented 1 year ago
$ sudo apt install libespeak-ng-dev
$ spd-conf -u
Traceback (most recent call last):
  File "/usr/local/bin/spd-conf", line 22, in <module>
    import speechd_config
ModuleNotFoundError: No module named 'speechd_config'
sthibaul commented 1 year ago

WHy is all of this happening all of a sudden? Not that long ago I could just install python3-speechd, espeak-ng with apt, run spd-conf -u and be done with the matter

You uninstalled python3-speechd, didn't you?

$ sudo apt install libespeak-ng-dev
$ spd-conf -u

libespeak-ng-dev is needed at the ./configure step. You need to restart from there.

guest271314 commented 1 year ago

Same error is thrown for spd-conf -u.

sthibaul commented 1 year ago

Installing libespeak-ng-dev is not meant to fix spd-conf -u, but to fix building the espeak-ng sd module. Does spd-say -O mention espeak-ng now?

sthibaul commented 1 year ago

Concerning spd-conf -u, as I mentioned you need to set your PYTHONPATH since apparently your distrib doesn't do it for you. Something like

export PYTHONPATH=/usr/local/lib/python3.11/site-packages

of course in that example you need to fix the path according to where speechd_config ended up.

guest271314 commented 1 year ago

of course in that example you need to fix the path according to where speechd_config ended up.

How do I determine that?

guest271314 commented 1 year ago

Does spd-say -O mention espeak-ng now?

Yes.

sthibaul commented 1 year ago

How do I determine that?

Well, look at what is there in /usr/local/lib etc.

guest271314 commented 1 year ago

Got it working in the browser. Is this an anamoly or something that should be jotted down as installation notes?

sthibaul commented 1 year ago

Got it working in the browser

Did you do anything particular to get it working?

guest271314 commented 1 year ago

Follow the instructions in this issue and finally

export PYTHONPATH=/usr/local/lib/python3.10/site-packages

followed by

spd-conf -u

then tested with https://guest271314.github.io/SSMLParser/.

It didn't use to be this complicated.

I have something like this in a startup script I run when I boot a new live-CD

sudo apt-get -y install libtool \
libcurl4-openssl-dev \
texinfo \
cmake \
bleachbit \
espeak-ng \
python3-speechd \
mpv \
git \
libssl-dev \
build-essential

I ran this code https://edvins.io/react-text-to-speech the other day and afterwards speechSynthesis.speak() didn't want to work.

guest271314 commented 1 year ago

Sure enough, after trying to run the code on this page https://edvins.io/react-text-to-speech speech-dispatcher-espeak-ng disappears from Pulse Audio audio mixer control, and spd-say test doesn't output audio any more. Using window.speechSynthesis.speak() shouldn't be able to mess with speech-dispatcher like that. What is going on?

sthibaul commented 1 year ago

What is going on?

As usual, the logs will tell us.

guest271314 commented 1 year ago

speech-dispatcher.log

sthibaul commented 1 year ago

It didn't use to be this complicated.

That's just because in this case we have been installing by hand to try to debunk what's getting wrong with your distribution-provided version.

sthibaul commented 1 year ago

Please remember to set LogLevel to 5, otherwise the log doesn't contain precious information for debugging

sthibaul commented 1 year ago

and ideally, remove the log files before starting your test, so that the log only contains information about your test

guest271314 commented 1 year ago

I think something on the linked page is breaking speech-dispatcher. Never observed that happen before where calling speechSynthesis.speak() and resume() makes speech-dispatcher-espeak-ng disappear from the Pulse Audio Playback page.

That is what lead me here to file this issue.

I removed the file speech-dispatcher.log from /run/user/999/speech-dispatcher/log.

It's is not getting recreated after speech-dispatcher restart. I think I can get speech-dispatcher working again by re-building after the audio stops working.

Not sure how that log file get recreated.

sthibaul commented 1 year ago

speech-dispatcher restart

What do you mean exactly by this? If you are also running a root-started speech-dispatcher, we'll get lost between your user's speech-dispatcher and root's speech-dispatcher. Autospawn does not need a root-started speech-dispatcher.

guest271314 commented 1 year ago

I don't see a way to restart speech-dispatcher in option so that's what I have been using.

I just re-created the log file in /log.

Then ran speech-dispatcher -l 5.

Audio just stopped when I pushed pause and then resume on the page that is causing the issue.

guest271314 commented 1 year ago

Nothing is witten to the speech-dispatcher.log file. So I need instructions on how to re-create that file, and re-start speech-dispatcher after setting LogLevel to 5.

sthibaul commented 1 year ago

I don't see a way to restart speech-dispatcher in option so that's what I have been using.

where that is what? Please actually answer my questions otherwise I have no idea what you are actually doing.

If you want to kill an existing speech-dispatcher you can just run killall speech-dispatcher

I just re-created the log file in /log.

That won't help. speech-dispatcher knows to create the log whenever it needs to. But for that to happen you need to avoid a root-started speech-dispatcher. E.g. use systemctl stop speech-dispatcher

I need instructions on how to re-create that file

No, you don't need to create it

and re-start speech-dispatcher after setting LogLevel to 5

No, you don't want to restart it, you want to kill the existing instance. So that auto-spawn actually happens just the way you had it at the very very beginning of this whole issue tracking.

guest271314 commented 1 year ago

What do you mean exactly by this?

where that is what? Please actually answer my questions otherwise I have no idea what you are actually doing.

I'm trying to restart speech-dispatcher.

Alright. I think I followed the instructions and here is the log file. Let me know if I missed something.

What happens is TTS audio stops being output altogether after I press play and pause then resume here https://edvins.io/react-text-to-speech. Which means this https://guest271314.github.io/SSMLParser/ doesn't output audio after I press play, pause , then resume on the above site.

speech-dispatcher.log

guest271314 commented 1 year ago

Looks like speech-dispatcher is breaking on speechSynthesis.pause() on Chromium 114.

guest271314 commented 1 year ago

speechSynthesis.pause() worked once on Firefox Nightly 113, then didn't work at all afterwards.

sthibaul commented 1 year ago

here is the log file

Ok, but a log of what test? All I can see there is two calls to spd-say yo , was there actually a bug while doing it?

guest271314 commented 1 year ago

I'm obviously on Linux. Each time I call speechSynthesis.pause() I have to restart everything, kill speech-dispatcher and run speech-dispatcher -a then I test with spd-say yo before trying on a Web page.