特殊:Badtitle/NS100:TextToSpeech:修订间差异
小 New page: {{From|https://help.ubuntu.com/community/TextToSpeech}} {{Languages|php5}} == Introduction == You can take advantage of Text-To-Speech in Ubuntu by using a program called Festival. Beca... |
小无编辑摘要 |
||
(未显示2个用户的9个中间版本) | |||
第1行: | 第1行: | ||
{{From|https://help.ubuntu.com/community/TextToSpeech}} | {{From|https://help.ubuntu.com/community/TextToSpeech}} | ||
{{Languages| | {{Languages|UbuntuHelp:TextToSpeech}} | ||
#title Festival - Text-to-Speech | |||
You can take advantage of Text-To-Speech in Ubuntu by using a program called ''Festival''. Out of the box, Festival doesn't work with ESD (the default sound server up to Gutsy), Pulse``Audio (the default sound server since Hardy) or ALSA, 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, Pulse``Audio and ALSA. | |||
If you are using a version of Ubuntu prior to Hardy, and you don't want to 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. | |||
You can take advantage of Text-To-Speech in Ubuntu by using a program called Festival. | |||
This | |||
== Installation == | == Installation == | ||
Install Festival by typing the following command in a Terminal: | |||
<code><nowiki>sudo apt-get install festival</nowiki></code> | |||
'''Note:''' Additional voices are available in the Ubuntu repositories. Type "festvox" in ''Synaptic Package Manager'' for a list of language packages. | |||
== Configuration for ESD or PulseAudio == | |||
If you want festival to always use ESD or PulseAudio for output, you can configure this globally, for all users, or on a per-user basis. To configure globally use the configuration file ''/etc/festival.scm''. To configure locally use the configuration file ''~/.festivalrc''. | |||
<ol><li>Open the configuration file by typing <code><nowiki>gksudo gedit /etc/festival.scm</nowiki></code> or <code><nowiki>gedit ~/.festivalrc</nowiki></code> in a terminal. | |||
</li><li>Add the following lines at the end of the file:</li></ol> | |||
<code><nowiki>(Parameter.set 'Audio_Method 'esdaudio)</nowiki></code> | |||
1.#3 Save the file. | |||
This is the recommended method for playing audio in Ubuntu. | |||
== 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 at the end of the file <code><nowiki>/etc/festival.scm or ~/.festivalrc</nowiki></code> the lines | |||
<pre><nowiki> | |||
(Parameter.set 'Audio_Command "aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE") | |||
== Configuration == | |||
<pre><nowiki>(Parameter.set 'Audio_Command " | |||
(Parameter.set 'Audio_Method 'Audio_Command) | (Parameter.set 'Audio_Method 'Audio_Command) | ||
(Parameter.set 'Audio_Required_Format 'snd)</nowiki></ | (Parameter.set 'Audio_Required_Format 'snd)</nowiki></pre> | ||
On some configurations it may be necessary to remove the "-D plug:dmix" part of the aplay command above. | |||
== Testing == | == Testing == | ||
Test your setup by typing in a Terminal | |||
Test your setup by typing | <code><nowiki>festival</nowiki></code> | ||
You will be presented with a ''>'' prompt. Type | |||
<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 type | <code><nowiki>(tts "FILENAME" nil)</nowiki></code> | ||
Note ''FILENAME'' must be in quote marks. | |||
> (tts FILENAME nil) | |||
FILENAME must be in quote marks. | |||
[[category:UbuntuHelp]] | [[category:UbuntuHelp]] |
2009年11月17日 (二) 20:47的最新版本
文章出处: |
{{#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. Out of the box, Festival doesn't work with ESD (the default sound server up to Gutsy), Pulse``Audio (the default sound server since Hardy) or ALSA, 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, Pulse``Audio and ALSA. If you are using a version of Ubuntu prior to Hardy, and you don't want to 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 repositories. Type "festvox" in Synaptic Package Manager for a list of language packages.
Configuration for ESD or PulseAudio
If you want festival to always use ESD or PulseAudio for output, you can configure this globally, for all users, or on a per-user basis. To configure globally use the configuration file /etc/festival.scm. To configure locally use the configuration file ~/.festivalrc.
- Open the configuration file by typing
gksudo gedit /etc/festival.scm
orgedit ~/.festivalrc
in a terminal. - Add the following lines at the end of the file:
(Parameter.set 'Audio_Method 'esdaudio)
1.#3 Save the file.
This is the recommended method for playing audio in Ubuntu.
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 at the end of the file /etc/festival.scm or ~/.festivalrc
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)
On some configurations it may be necessary to remove the "-D plug:dmix" part of the aplay command above.
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.