个人工具

“UbuntuHelp:TextToSpeech”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/TextToSpeech}}
 
{{From|https://help.ubuntu.com/community/TextToSpeech}}
 
{{Languages|UbuntuHelp:TextToSpeech}}
 
{{Languages|UbuntuHelp:TextToSpeech}}
#title Text-to-Speech
+
#title Festival - Text-to-Speech
  
  
You can take advantage of Text-To-Speech in Ubuntu by using a program called ''Festival''. Festival doesn't work with ESD (the default sound mixer) out of the box, so some changes are required to get it up and running.
+
You can take advantage of Text-To-Speech in Ubuntu by using a program called ''Festival''. Festival doesn't work with ESD (the default sound mixer) or ALSA out of the box, so some changes are required to get it up and running.
  
This guide provides instructions on how to get Festival working on Ubuntu with ESD. If you don't use Festival with ESD, you will have to disable ESD in the ''Sounds'' preferences dialog. In that case, other multimedia applications won't be able to play audio at the same time.
+
This guide provides instructions on how to get Festival working on Ubuntu with ESD or ALSA.  
 +
 
 +
If you don't use Festival with ESD, you will have to disable ESD in the ''Sounds'' preferences dialog. In that case, other multimedia applications won't be able to play audio at the same time.
  
 
== Installation ==
 
== Installation ==
  
* Install Festival by typing the following command in a Terminal:
+
Install Festival by typing the following command in a Terminal:
<pre><nowiki>sudo apt-get install festival
+
<code><nowiki>sudo apt-get install festival</nowiki></code>
</nowiki></pre>
+
*#2 Install ''esdplay'', which is part of the ''esound-clients'' package:
+
<pre><nowiki>sudo apt-get install esound-clients
+
</nowiki></pre>
+
  
 
'''Note:''' Additional voices are available in the Ubuntu respositories. Type "festival" in ''Synaptic Package Manager'' for a list of packages.
 
'''Note:''' Additional voices are available in the Ubuntu respositories. Type "festival" in ''Synaptic Package Manager'' for a list of packages.
  
== Configuration ==
+
== Configuration for ESD ==
 +
 
 +
Install ''esdplay'', which is part of the ''esound-clients'' package:
 +
<code><nowiki>sudo apt-get install esound-clients</nowiki></code>
  
 
You need to configure festival so that it sends its output through ESD. Otherwise, you will get a ''can't open /dev/dsp'' error when you try to run Festival.
 
You need to configure festival so that it sends its output through ESD. Otherwise, you will get a ''can't open /dev/dsp'' error when you try to run Festival.
第29行: 第30行:
 
(Parameter.set 'Audio_Required_Format 'snd)</nowiki></pre>
 
(Parameter.set 'Audio_Required_Format 'snd)</nowiki></pre>
 
*#3 Save the file.
 
*#3 Save the file.
 +
 +
== Configuration for ALSA ==
 +
 +
('''Note''' it is hard to use ALSA and ESD on the same system, if it is possible at all.  Here it is assumed that you are using ALSA ''instead of'' ESD.)
 +
 +
Insert of the end of the file <code><nowiki>/etc/festival.scm</nowiki></code> the lines
 +
 +
<pre><nowiki>(Parameter.set 'Audio_Command "aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE")
 +
(Parameter.set 'Audio_Method 'Audio_Command)
 +
(Parameter.set 'Audio_Required_Format 'snd)</nowiki></pre>
 +
 +
Some sources leave off the <code><nowiki>-D plug:dmix </nowiki></code>; maybe that works for older systems, but it didn't work in my Feisty.
  
 
== Testing ==
 
== Testing ==
  
* Test your setup by typing <code><nowiki>festival</nowiki></code> in a Terminal.
+
Test your setup by typing in a Terminal
* You will be presented with a ''>'' prompt. Type <code><nowiki>(Say``Text "Hello"</nowiki></code>.
+
<code><nowiki>festival</nowiki></code>
* The computer should say "hello".
+
 
* To listen to a text file type <code><nowiki>(tts "FILENAME" nil)</nowiki></code>. ''FILENAME'' must be in quote marks.
+
You will be presented with a ''>'' prompt. Type  
 +
<code><nowiki>(SayText "Hello")</nowiki></code>
 +
The computer should say "hello".
 +
 
 +
To listen to a text file named ''FILENAME'', type  
 +
<code><nowiki>(tts "FILENAME" nil)</nowiki></code>
 +
Note ''FILENAME'' must be in quote marks.
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2007年11月21日 (三) 17:54的版本

  1. title Festival - Text-to-Speech


You can take advantage of Text-To-Speech in Ubuntu by using a program called Festival. Festival doesn't work with ESD (the default sound mixer) or ALSA out of the box, so some changes are required to get it up and running.

This guide provides instructions on how to get Festival working on Ubuntu with ESD or ALSA.

If you don't use Festival with ESD, you will have to disable ESD in the Sounds preferences dialog. In that case, other multimedia applications won't be able to play audio at the same time.

Installation

Install Festival by typing the following command in a Terminal: sudo apt-get install festival

Note: Additional voices are available in the Ubuntu respositories. Type "festival" in Synaptic Package Manager for a list of packages.

Configuration for ESD

Install esdplay, which is part of the esound-clients package: sudo apt-get install esound-clients

You need to configure festival so that it sends its output through ESD. Otherwise, you will get a can't open /dev/dsp error when you try to run Festival.

  • Open the file /etc/festival.scm by typing gksudo gedit /etc/festival.scm in a Terminal.
  • Add the following lines at the end of the file:
(Parameter.set 'Audio_Command "esdplay $FILE")
(Parameter.set 'Audio_Method 'Audio_Command)
(Parameter.set 'Audio_Required_Format 'snd)
    1. 3 Save the file.

Configuration for ALSA

(Note it is hard to use ALSA and ESD on the same system, if it is possible at all. Here it is assumed that you are using ALSA instead of ESD.)

Insert of the end of the file /etc/festival.scm the lines

(Parameter.set 'Audio_Command "aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE")
(Parameter.set 'Audio_Method 'Audio_Command)
(Parameter.set 'Audio_Required_Format 'snd)

Some sources leave off the -D plug:dmix ; maybe that works for older systems, but it didn't work in my Feisty.

Testing

Test your setup by typing in a Terminal festival

You will be presented with a > prompt. Type (SayText "Hello") The computer should say "hello".

To listen to a text file named FILENAME, type (tts "FILENAME" nil) Note FILENAME must be in quote marks.