You are not logged in.

#1 2021-05-15 17:31:36

xuve
Member
Registered: 2021-05-09
Posts: 23

Does Okular have a speech engine inside...?

I was editing a .pdf file in okular, a great app, and when I R-clicked I had this option down here with the arrow towards it that says speak text...I thought it was like the text-to-speech utility...
c6ZHS4ft.png

Offline

#2 2021-05-15 17:37:35

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,370
Website

Re: Does Okular have a speech engine inside...?

According to this page from 2018
https://www.ubuntubuzz.com/2018/12/text … peech.html
you need to install few things first.

Offline

#3 2021-05-16 14:07:50

xuve
Member
Registered: 2021-05-09
Posts: 23

Re: Does Okular have a speech engine inside...?

Hi brontosaurusrex,
I did find the packages in synaptic and installed according to that page. It was all clear and simple and it worked:THANK YOU for your valuable help. I hope the voice will be more updated later to look like a real human's...

Offline

#4 2021-05-16 16:11:30

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,370
Website

Re: Does Okular have a speech engine inside...?

There are some additional voices, but not sure if any is better than default

apt-cache search mbrola-
sudo apt install mbrola mbrola-us2
espeak -v mb-us2 -p 70 -s 120 "everything has transpired according to my design."

Last edited by brontosaurusrex (2021-05-16 16:14:08)

Offline

#5 2021-05-17 03:29:28

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 8,277
Website

Re: Does Okular have a speech engine inside...?

Thanks to @bronto I spent 1/2 hour playing with espeak voices and ended up agreeing none of them seemed particularly better than default, at least for understandability.  Back to espeak default.

Then spent another good half hour or more searching for other options...
https://elinux.org/RPi_Text_to_Speech_( … Synthesis)
https://circuitdigest.com/microcontroll … nd-pyttsx3
https://askubuntu.com/questions/53896/n … -to-speech
https://linuxreviews.org/Text_to_Speech … s_software

Installed and ran festival but was under-impressed.

Mimic's sound snippet sounded good but it needs to be compiled for Debian. Later...

Pico2wave actually sounds better than espeak, and is on Debian, but
1) It only supports English.
2) It needs a tricky workaround to output directly as speech, not to a file.
Even so, some people might find it worth checking:

sudo apt-get install libttspico-utils
ln -s /dev/stdout ~/pico.wav # choose a better location
pico2wave --wave=~/pico.wav "everything has Transpired according to my design." | aplay

...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#6 2021-05-18 06:13:49

ohnonot
...again
Registered: 2015-09-29
Posts: 5,554

Re: Does Okular have a speech engine inside...?

johnraff wrote:

I spent 1/2 hour playing with espeak voices and ended up agreeing none of them seemed particularly better than default, at least for understandability.

flite is better. Not as good as backed-by-AI-fed-by-billions-of-users-data, but better than espeak for sure.
A quick test with the default voices, it seems to be roughly on par with festival. But a lot depends on the chosen voice.


Give to COVAX! Here or here. (explanation)

Offline

#7 2021-05-18 06:53:15

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 8,277
Website

Re: Does Okular have a speech engine inside...?

^Just installed and ran flite. To me (with the default voice) it sounded a bit gravelly, a lot like festival and only marginally better than espeak.

I do recommend giving pico2wave a try - it sounds smoother than any of the above, IMO.
EDIT I am getting an annoying click at the end of messages though, and it might sound a bit "muffled".

EDIT2 I hereby withdraw my recommendation of pico2wave. Once I tried @bronto's recommendation of '-voice slt' with flite it sounded much better.

There's no mention of '-voice' in 'man flite'', or of '-lv' to list the installed voices. roll

And downloading the alternative .festvox voices from http://www.festvox.org/flite/packed/flite-2.0/voices/ was a 550MB waste of time. Tried them all, and slt was still the best IMO.

Last edited by johnraff (2021-05-19 05:17:32)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#8 2021-05-18 08:47:33

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,370
Website

Re: Does Okular have a speech engine inside...?

Flite is fast (I use it in scripts that run long time), but mostly it has a very short text to read

flite -voice slt -t "Done."

or in the radio script to announce the array id

flite -voice slt -t "$id" &> /dev/null &

Last edited by brontosaurusrex (2021-05-18 09:05:37)

Offline

#9 2021-05-18 17:53:50

xuve
Member
Registered: 2021-05-09
Posts: 23

Re: Does Okular have a speech engine inside...?

thank you @ohnonot flite sounds better and if I add punctuation it is less fast and clearer...thanks to all who participated in helping me out...I used the flite terminal command from you brontosaurusrex...but if i go to okular and click speak text now nothing happens..maybe it has to do with the flite installation packages from synaptic...

Offline

#10 2021-05-18 18:02:55

xuve
Member
Registered: 2021-05-09
Posts: 23

Re: Does Okular have a speech engine inside...?

I got it back I did a reinstall because I had this error
E: Internal Error, No file name for speechd-up:amd64
so I removed the entire pkg and reinstalled back however I didn't think it was going to work as the installation black screen kept going back and forth for a long time...
Is there a way to integrate flite voices into okular or just by terminal...

Offline

#11 2021-05-19 09:38:24

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,370
Website

Re: Does Okular have a speech engine inside...?

What is the amount of integration with okular? Does it show word by word or line by line what is reading?
Is there any advanced logic to only read 'what it matters'?
(I'd have to test that before giving any meaningful answer.)

Other than that, funny stuff happens with

pdftotext test.pdf - | flite -voice slt

(pdftotext is part of calibre)

Text to lossy audio

flite -voice slt -t "Chuck Norris does not sleep. He waits." -o /dev/stdout | opusenc - - > chuck.opus

A lot of Chuck jokes

curl https://raw.githubusercontent.com/brontosaurusrex/stretchbang/master/.experiments/jokes/chuck-norris-jokes.txt | shuf | flite -voice http://festvox.org/flite/packed/flite-2.1/voices/cmu_us_aew.flitevox

Last edited by brontosaurusrex (2021-05-19 17:46:30)

Offline

#12 2021-05-20 18:35:45

xuve
Member
Registered: 2021-05-09
Posts: 23

Re: Does Okular have a speech engine inside...?

@brontosaurusrex just instead of having the default voice, you can choose flite voice within okular, that's all
Thanks for the jokes some are really hilarious...(but don't tell chuck I said that)

Offline

#13 2021-05-21 08:10:05

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,370
Website

Re: Does Okular have a speech engine inside...?

I'am thinking a more general 'solution' could be made, for example this should read clipboard, so ctrl+c in okular and then

xclip -selection clipboard -o - && xclip -selection clipboard -o - | flite -voice slt
# And you could turn that into alias/script/button.

However I can't make it to work every time, it stops reading when it feels like (presumably confused with some special chars).

Illustration on how this could work
fIteSBP.png

edit: And a little script for the same purpose, trying to avoid flite getting quiet, also brings line by line reading (reflowing at punctuations), it would need some more work, but should be usable right now.
https://raw.githubusercontent.com/bront … in/youread
edit2: Added google text to speech option (via gtts) that actually almost sounds like a real voice, but this is now moving things into cloud, so beware of any possible privacy implications before installing/enabling it. p.s. engine="flite" is completely offline.

Last edited by brontosaurusrex (2021-05-21 21:19:35)

Offline

#14 2021-05-21 18:19:40

xuve
Member
Registered: 2021-05-09
Posts: 23

Re: Does Okular have a speech engine inside...?

yes a more general solution is better, the unix system also uses a more general tab in the settings under speech & dictation and from there also you can choose the voice and the language but that's just  for talking as for the work it needs...I don't know how to estimate the brain-sweat for that operation...
thank you for your hard work...

Offline

Board footer

Powered by FluxBB