特殊:Badtitle/NS100:TextToSpeech:修订间差异
小无编辑摘要 |
小无编辑摘要 |
||
第2行: | 第2行: | ||
{{Languages|UbuntuHelp:TextToSpeech}} | {{Languages|UbuntuHelp:TextToSpeech}} | ||
#title Festival - 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) or ALSA 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 or ALSA. | 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. | 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: | ||
<code><nowiki>sudo apt-get install festival</nowiki></code> | <code><nowiki>sudo apt-get install festival</nowiki></code> | ||
'''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 for ESD == | == Configuration for ESD == | ||
Install ''esdplay'', which is part of the ''esound-clients'' package: | Install ''esdplay'', which is part of the ''esound-clients'' package: | ||
<code><nowiki>sudo apt-get install esound-clients</nowiki></code> | <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. | ||
# Open the file ''/etc/festival.scm'' by typing <code><nowiki>gksudo gedit /etc/festival.scm</nowiki></code> in a Terminal. | |||
# Add the following lines at the end of the file: | |||
<pre><nowiki>(Parameter.set 'Audio_Command "esdplay $FILE") | <pre><nowiki>(Parameter.set 'Audio_Command "esdplay $FILE") | ||
(Parameter.set 'Audio_Method 'Audio_Command) | (Parameter.set 'Audio_Method 'Audio_Command) | ||
(Parameter.set 'Audio_Required_Format 'snd)</nowiki></pre> | (Parameter.set 'Audio_Required_Format 'snd)</nowiki></pre> | ||
1.#3 Save the file. | |||
== Configuration for ALSA == | == 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.) | ('''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 | 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") | <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_Method 'Audio_Command) | ||
(Parameter.set 'Audio_Required_Format 'snd)</nowiki></pre> | (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. | 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 in a Terminal | Test your setup by typing in a Terminal | ||
<code><nowiki>festival</nowiki></code> | <code><nowiki>festival</nowiki></code> | ||
You will be presented with a ''>'' prompt. Type | You will be presented with a ''>'' prompt. Type | ||
<code><nowiki>(SayText "Hello")</nowiki></code> | <code><nowiki>(SayText "Hello")</nowiki></code> | ||
The computer should say "hello". | The computer should say "hello". | ||
To listen to a text file named ''FILENAME'', type | To listen to a text file named ''FILENAME'', type | ||
<code><nowiki>(tts "FILENAME" nil)</nowiki></code> | <code><nowiki>(tts "FILENAME" nil)</nowiki></code> |
2007年11月30日 (五) 21:44的版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/TextToSpeech }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/af | • {{#if: UbuntuHelp:TextToSpeech|Afrikaans| [[::TextToSpeech/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/ar | • {{#if: UbuntuHelp:TextToSpeech|العربية| [[::TextToSpeech/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/az | • {{#if: UbuntuHelp:TextToSpeech|azərbaycanca| [[::TextToSpeech/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/bcc | • {{#if: UbuntuHelp:TextToSpeech|جهلسری بلوچی| [[::TextToSpeech/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/bg | • {{#if: UbuntuHelp:TextToSpeech|български| [[::TextToSpeech/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/br | • {{#if: UbuntuHelp:TextToSpeech|brezhoneg| [[::TextToSpeech/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/ca | • {{#if: UbuntuHelp:TextToSpeech|català| [[::TextToSpeech/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/cs | • {{#if: UbuntuHelp:TextToSpeech|čeština| [[::TextToSpeech/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/de | • {{#if: UbuntuHelp:TextToSpeech|Deutsch| [[::TextToSpeech/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/el | • {{#if: UbuntuHelp:TextToSpeech|Ελληνικά| [[::TextToSpeech/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/es | • {{#if: UbuntuHelp:TextToSpeech|español| [[::TextToSpeech/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/fa | • {{#if: UbuntuHelp:TextToSpeech|فارسی| [[::TextToSpeech/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/fi | • {{#if: UbuntuHelp:TextToSpeech|suomi| [[::TextToSpeech/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/fr | • {{#if: UbuntuHelp:TextToSpeech|français| [[::TextToSpeech/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/gu | • {{#if: UbuntuHelp:TextToSpeech|ગુજરાતી| [[::TextToSpeech/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/he | • {{#if: UbuntuHelp:TextToSpeech|עברית| [[::TextToSpeech/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/hu | • {{#if: UbuntuHelp:TextToSpeech|magyar| [[::TextToSpeech/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/id | • {{#if: UbuntuHelp:TextToSpeech|Bahasa Indonesia| [[::TextToSpeech/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/it | • {{#if: UbuntuHelp:TextToSpeech|italiano| [[::TextToSpeech/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/ja | • {{#if: UbuntuHelp:TextToSpeech|日本語| [[::TextToSpeech/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/ko | • {{#if: UbuntuHelp:TextToSpeech|한국어| [[::TextToSpeech/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/ksh | • {{#if: UbuntuHelp:TextToSpeech|Ripoarisch| [[::TextToSpeech/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/mr | • {{#if: UbuntuHelp:TextToSpeech|मराठी| [[::TextToSpeech/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/ms | • {{#if: UbuntuHelp:TextToSpeech|Bahasa Melayu| [[::TextToSpeech/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/nl | • {{#if: UbuntuHelp:TextToSpeech|Nederlands| [[::TextToSpeech/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/no | • {{#if: UbuntuHelp:TextToSpeech|norsk| [[::TextToSpeech/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/oc | • {{#if: UbuntuHelp:TextToSpeech|occitan| [[::TextToSpeech/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/pl | • {{#if: UbuntuHelp:TextToSpeech|polski| [[::TextToSpeech/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/pt | • {{#if: UbuntuHelp:TextToSpeech|português| [[::TextToSpeech/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/ro | • {{#if: UbuntuHelp:TextToSpeech|română| [[::TextToSpeech/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/ru | • {{#if: UbuntuHelp:TextToSpeech|русский| [[::TextToSpeech/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/si | • {{#if: UbuntuHelp:TextToSpeech|සිංහල| [[::TextToSpeech/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/sq | • {{#if: UbuntuHelp:TextToSpeech|shqip| [[::TextToSpeech/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/sr | • {{#if: UbuntuHelp:TextToSpeech|српски / srpski| [[::TextToSpeech/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/sv | • {{#if: UbuntuHelp:TextToSpeech|svenska| [[::TextToSpeech/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/th | • {{#if: UbuntuHelp:TextToSpeech|ไทย| [[::TextToSpeech/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/tr | • {{#if: UbuntuHelp:TextToSpeech|Türkçe| [[::TextToSpeech/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/vi | • {{#if: UbuntuHelp:TextToSpeech|Tiếng Việt| [[::TextToSpeech/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/yue | • {{#if: UbuntuHelp:TextToSpeech|粵語| [[::TextToSpeech/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/zh | • {{#if: UbuntuHelp:TextToSpeech|中文| [[::TextToSpeech/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/zh-hans | • {{#if: UbuntuHelp:TextToSpeech|中文(简体)| [[::TextToSpeech/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:TextToSpeech | UbuntuHelp:TextToSpeech | {{#if: | :}}TextToSpeech}}/zh-hant | • {{#if: UbuntuHelp:TextToSpeech|中文(繁體)| [[::TextToSpeech/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:TextToSpeech|:TextToSpeech|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :TextToSpeech/zh | | {{#ifexist: TextToSpeech/zh | | {{#ifeq: {{#titleparts:TextToSpeech|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:TextToSpeech|1|-1|}} | zh | | }}
- 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.