Do we have a text to speech feature?

I’ve just tried Google Docs Accessibilities and it wont work:
References: https://cs224d.stanford.edu/reports/DasSubhasis.pdf
https://productforums.google.com/forum/?utm_medium=email&utm_source=footer#!msg/docs/4rGJxLY4_-M/NmVVAh9GCAAJ

The pdf link shows they used pyttsx for text to speech. On the TX2, you’d likely want to use a bluetooth speaker setup since the other options (i2s, etc.) don’t seem to work as well as bluetooth.

As alternatives to pyttsx, I might try one of these:

http://elinux.org/RPi_Text_to_Speech_(Speech_Synthesis)

Does that help? What does Google Docs Accessibilities have to do with the PDF paper?

Thank you for your response.
Google Docs accessibilities shouldn’t have the capping in 5,000 symbols which does translate.google com which I am currently using has. By now I copy txt from pdf and paste it to the “translate” by google and that result in more or less fine audio.
Basically I am doing a coursework and should read a book about 800 of pages which I have on pdf.

The document I am approaching is https://learn.saylor.org/pluginfile.php/235273/mod_resource/content/3/Conger-NewSoftwareEngineering.pdf
I tried okular but its reading is so noisy.
By now the better quality seems to be achieved with translate y Google , but to split text to 5,000 fragments seems not to be very handy.

Do you have any idea on how to tie the section with reading of text.txt file option:

#!/bin/bash
say() { local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&q=$*&tl=en"; }
say $*
chmod u+x speech.sh
./speech.sh Look Dave, I can see you're really upset about this.

found something

#!/bin/bash
#################################
# Speech Script by Dan Fountain #
#      TalkToDanF@gmail.com     #
#################################
 
 
INPUT=$*
STRINGNUM=0
 
ary=($INPUT)
echo "---------------------------"
echo "Speech Script by Dan Fountain"
echo "TalkToDanF@gmail.com"
echo "---------------------------"
for key in "${!ary[@]}" 
  do
    SHORTTMP[$STRINGNUM]="${SHORTTMP[$STRINGNUM]} ${ary[$key]}"
    LENGTH=$(echo ${#SHORTTMP[$STRINGNUM]})
    #echo "word:$key, ${ary[$key]}"
    #echo "adding to: $STRINGNUM"
    if [[ "$LENGTH" -lt "100" ]]; then
      #echo starting new line
      SHORT[$STRINGNUM]=${SHORTTMP[$STRINGNUM]}
    else
      STRINGNUM=$(($STRINGNUM+1))
      SHORTTMP[$STRINGNUM]="${ary[$key]}"
      SHORT[$STRINGNUM]="${ary[$key]}"
    fi
done
 
for key in "${!SHORT[@]}"
  do
    #echo "line: $key is: ${SHORT[$key]}"
 
    echo "Playing line: $(($key+1)) of $(($STRINGNUM+1))"
    NEXTURL=$(echo ${SHORT[$key]} | xxd -plain | tr -d '\n' | sed 's/\(..\)/%/g')
    mpg123 -q "http://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&q=$NEXTURL&tl=En-us"
done

the above seems to split big fragments of text automatically
but how to feed to it a file text.txt to read

should it be a function like read.sh <cat text.txt implemented somehow

if I paste a text directly to the string :
INPUT=“one two three four”
it does work, but when I add a big fragment it wont execute

read.sh $(cat text.txt)

I have another recommendation:

  1. Use a USB sound output device. USB sound output is robust and easy to work with, and doesn't have the risk of losing connection like Bluetooth.
  2. Use festival as the Text-to-Speech engine. This has pre-made ubuntu packages.
  3. Install the high-quality Festival voices (or at least one of them) for high quality output.

Here’s a reasonably-priced sound output device:
http://amzn.to/2rrvHYx

Here’s a good blog post about it:
https://ubuntuforums.org/showthread.php?t=677277

I would recommend against using the Google API to generate speech, for three reasons (at least, these were true when I looked at this in the past):

  1. You need to always be internet connected.
  2. Google sometimes changes their APIs and this means you have to update your software.
  3. The translate APIs are rate limited, and aren't intended for reliable deployments without additional volume fees.

Checking the festival:

sudo apt-get install festival
sudo apt-get install festlex-cmu

References: https://ubuntuforums.org/showthread.php?t=677277

cd /usr/share/festival/voices/english/
sudo wget -c http://www.speech.cs.cmu.edu/cmu_arctic/packed/cmu_us_clb_arctic-0.95-release.tar.bz2
sudo tar jxf cmu_us_clb_arctic-0.95-release.tar.bz2 
sudo ln -s cmu_us_clb_arctic cmu_us_clb_arctic_clunits
sudo cp /etc/festival.scm /etc/festival.scm.backup
sudo echo "(set! voice_default 'voice_cmu_us_clb_arctic_clunits)" >> /etc/festival.scm

than

echo "This is a test." | festival --tts

results in

echo "This is a test." | festival --tts
SIOD ERROR: unbound variable : voice_cmu_us_clb_arctic_clunits
Error evaluating default voice: voice_cmu_us_clb_arctic_clunits
continuing
-=-=-=-=-=- EST Error -=-=-=-=-=-
{FND} Feature Token_Method not defined

aaa, whrong file name
fixing

stil broken

echo "This is a test." | festival --tts
SIOD ERROR: unbound variable : voice_cmu_us_awb_arctic_clunits
Error evaluating default voice: voice_cmu_us_awb_arctic_clunits
continuing
-=-=-=-=-=- EST Error -=-=-=-=-=-
{FND} Feature Token_Method not defined

fixing again:

sudo ln -s cmu_us_awb_arctic cmu_us_awb_arctic

still broken:

echo "This is a test." | festival --tts
SIOD ERROR: unbound variable : voice_cmu_us_awb_arctic_clunits
Error evaluating default voice: voice_cmu_us_awb_arctic_clunits
continuing
-=-=-=-=-=- EST Error -=-=-=-=-=-
{FND} Feature Token_Method not defined

trying one more time:
1 cmu_us_awb_arctic downloaded

sudo ln -s cmu_us_awb_arctic cmu_us_awb_arctic_clunits
sudo echo "(set! voice_default 'voice_cmu_us_awb_arctic_clunits)" >> /etc/festival.scm

wont work;
trying with sudo wget -c http://www.speech.cs.cmu.edu/cmu_arctic/packed/cmu_us_clb_arctic-0.95-release.tar.bz2

the same error

lets debug it:

cat /etc/festival.scm
;; WARNING: It is inherently insecure to run a festival instance as a
;; server, mainly because it exposes the whole system to exploits which
;; can be easily used by attackers to gain access to your
;; computer. This is because of the inherent design of the festival
;; server. Please use it only in a situation where you are sure that
;; you will not be subjected to such an attack, or have adequate
;; security precautions.

;; This file has been provided as an example file for your use, should
;; you wish to run festival as a server.

; Maximum number of clients on the server
;(set! server_max_clients 10)

; Server port
;(set! server_port 1314)

; Server password:
;(set! server_passwd "password")

; Log file location
;(set! server_log_file "/var/log/festival/festival.log")

; Server access list (hosts)
; Example:
; (set! server_access_list '("[^.]+" "127.0.0.1" "localhost.*" "192.168.*"))
; Secure default:
;(set! server_access_list '("[^.]+" "127.0.0.1" "localhost"))

; Server deny list (hosts)

;; Debian-specific: Use aplay to play audio
(Parameter.set 'Audio_Command "aplay -q -c 1 -t raw -f s16 -r $SR $FILE")
(Parameter.set 'Audio_Method 'Audio_Command)
(set! voice_default 'voice_cmu_us_clb_arctic_clunits)
(set! voice_default 'voice_cmu_us_awb_arctic_clunits)
(set! voice_default 'voice_cmu_us_awb_arctic_clunits)
(set! voice_default 'voice_cmu_us_clb_arctic_clunits)