Monday, March 8, 2010

Fedora Talking to you

# [root@rajat Rajat]# yum install espeak
Loaded plugins: presto, refresh-packagekit
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package espeak.x86_64 0:1.40.02-3.fc12 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
espeak x86_64 1.40.02-3.fc12 fedora 605 k

Transaction Summary
================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)

Total download size: 605 k
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 605 k
espeak-1.40.02-3.fc12.x86_64.rpm | 605 kB 00:14
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : espeak-1.40.02-3.fc12.x86_64 1/1

Installed:
espeak.x86_64 0:1.40.02-3.fc12

Complete!

Example 1: Speak the words specified in command line

This is the default usage.

# espeak --stdout 'words to speak' | aplay

Note: The above may also display the following message: “Playing WAVE ’stdin’ : Signed 16 bit Little Endian, Rate 22050 Hz, Mono”
Example 2: Speak the words specified in stdin

This will take the words interactively from the standard input and convert it to speech.

# espeak --stdout | aplay

Example 3: Speak your document

This will convert the text from the mydocument.txt to speech.

# espeak --stdout -t mydocument.txt | aplay

Example 4: Generate voice file from text document

Convert your text file to an audio file as shown below.

# espeak -t mydocument.txt -w myaudio.wav

Customizing espeak

If you find the default speech synthesizing is not good, you can try to customize it as explained below.
Example 5: List all available voice languages

# espeak --voices
Pty Language Age/Gender VoiceName File Other Langs
5 af M afrikaans af
5 bs M bosnian bs
5 ca M catalan ca
5 cs M czech cs
5 cy M welsh-test cy
5 de M german de
5 el M greek el
5 en M default default
5 en-sc M en-scottish en/en-sc (en 4)
.......

Example 6: Choose a different voice language

The following will use “en-uk” – British english to translate the text to speech.

# espeak -v en-uk --stdout 'reading tips & tricks in TGS' | aplay

Example 7: Increase or Decrease the number of spoken words per minute.

The default is 160 words per minute. You can reduce it using option -s as shown below.

# espeak -s 140 -f mydocument.txt | aplay

Example 8: List the available espeak voices in specific language

The following example will display all possible english language variation that you can use for your text to speech conversion.

# espeak --voice=en
Pty Language Age/Gender VoiceName File Other Langs
2 en-uk M english en/en (en 2)
3 en-uk M english-mb-en1 mb/mb-en1 (en 2)
2 en-us M english-us en/en-us (en-r 5)(en 3)
5 en-sc M en-scottish en/en-sc (en 4)
5 en M default default
.....

No comments: