How to get speech output from entered text by using command-line?
Also facility to change speech rate, pitch, volume etc using simple command.
In order of descending popularity:
say converts text to audible speech using the GNUstep speech engine.
sudo apt-get install gnustep-gui-runtime say "hello"
festival General multi-lingual speech synthesis system.
sudo apt-get install festival echo "hello" | festival --tts
spd-say sends text-to-speech output request to speech-dispatcher
sudo apt-get install speech-dispatcher spd-say "hello"
espeak is a multi-lingual software speech synthesizer.
sudo apt-get install espeak espeak "hello"
NAME spd-say - send text-to-speech output request to speech-dispatcher SYNOPSIS spd-say [options] "some text" DESCRIPTION spd-say sends text-to-speech output request to speech-dispatcher process which handles it and ideally outputs the result to the audio system. OPTIONS -r, --rate Set the rate of the speech (between -100 and +100, default: 0) -p, --pitch Set the pitch of the speech (between -100 and +100, default: 0) -i, --volume Set the volume (intensity) of the speech (between -100 and +100, default: 0)
Hence you can get text-to-speech by following command:
spd-say "<type text>"
spd-say "Welcome to Ubuntu Linux"
You can also set speech rate, pitch, volume etc. see man-page.
Python Google Speach :
pip install google_speech google_speech "Test the hello world"
Svox From Android :
apt-get install svox-pico pico2wave --wave=test.wav "Test the hello world" play test.wav
Svox Nanotts :
git clone https://github.com/gmn/nanotts.git cd nanotts make ./nanotts -v en-US "Test the hello world"
Links - Wiki :
festival (the voice seems more natural to me):
sudo apt-get install festival
echo "hello" | festival --tts
Pitch and speed configuration:
(Parameter.set 'Audio_Command "play -b 16 -c 1 -e signed-integer -r $SR -t raw $FILE tempo 1.5 pitch -100")
(Parameter.set 'Audio_Method 'Audio_Command)
Update: tried on another ubuntu computer. Had to install english speech engine package to work with festival properly:
sudo apt-get install festvox-kallpc16k
play is a cli command which comes with
sudo apt-get install sox
November 2017 Ubuntu 16.04
For my project,
cron jobs that can talk,
espeak is the simplest.
sudo apt-get update sudo apt-get install espeak
For the first part, making the system speak the time requires a single cron entry
0 * * * * /home/username/scripts/saytime
#!/bin/bash echo "\`$(date +%H)\` Hundred" | espeak
It can receive input via stdio, like so:
cat textfile | espeak -s 100
For reference, here are selected command-line options for eSpeak:
espeak [options] [""]
Amplitude, 0 to 200, default is 100
Word gap. Pause between words, units of 10mS at the default speed
Indicate capital letters with: 1=sound, 2=the word "capitals", higher values indicate a pitch increase (try -k20).
Line length. If not zero (which is the default), consider lines less than this length as end-of-clause
Pitch adjustment, 0 to 99, default is 50
Speed in words per minute, 80 to 450, default is 175
Use voice file of this name from espeak-data/voices
Write speech to this WAV file, rather than speaking it directly
No final sentence pause at the end of the text
List the available voices for the specified language. If <language> is omitted, then list all voices.