Mac OS X "say" command in Ubuntu?

63

25

Is there an equivalent to the Mac's terminal command "say" in Ubuntu 9.10?

roflwaffle

Posted 2010-01-09T23:29:12.463

Reputation: 1 640

3

As an aside: a nice list of English sentences in which Mac OS X understands the context quite well, like "My name is Dr. Smith and I live on Smith Dr.", "The soldier decided to desert his dessert in the desert", "The guard will permit you to pass if you show a valid permit" and "It is much rainier on the slopes of Mt. Rainier" at http://www.macosxhints.com/comment.php?mode=view&cid=107211

– Arjan – 2010-01-10T10:36:52.917

Answers

68

espeak should be installed by default as text-to-speech engine on Linux.

You should be able to get it to speak from command-line by doing something like this:

echo "Text to speak"|espeak

You can also start espeak by just entering espeak itself, and then enter each line of text you want spoken followed by enter.

Other TTS engines for Linux you could look at:

Espeak is available at (but should be installed by default!):

Meta Bergman

Posted 2010-01-09T23:29:12.463

Reputation: 1 340

on Linux Mint is NOT installed by default ;) – daveoncode – 2015-06-26T09:01:29.107

3If you wanted this to directly replace the say command you could use a function:

function say() { echo "@" | espeak ; } – Jason Axelson – 2010-07-29T04:25:23.630

1Espeak is not installed by default on Ubuntu. – jasonszhao – 2017-06-09T00:05:35.707

29

alias say='echo "$1" | espeak -s 120 2>/dev/null'

Then you can use:

say 'How are you doing?'

Explanation:

-s 120 #to make it slower than default
2>/dev/null #to eliminate error masseges on the console

rodvlopes

Posted 2010-01-09T23:29:12.463

Reputation: 393

1this doesn't seem to work when i source .bashrc from a script – chovy – 2018-12-09T00:16:28.013

6

There are a number of speech synthesizers available to install in karmic, most of the ones I've tried have a console version.

Search for "Speech" in synaptic to get the full list. The espeak package works like say.

Seth

Posted 2010-01-09T23:29:12.463

Reputation: 997

3

install speech-dispatcher along with a synthesizer (flite, festival, etc) then

alias say='echo "$1" | spd-say -p -25 -e'

that will use whatever synthesizer you have configured.

The -p -25 is setting the pitch lower... change as desired. -e uses stdin

user104502

Posted 2010-01-09T23:29:12.463

Reputation: 86