Festival
From ArchWiki
Festival is a general multi-lingual speech synthesis system developed at CSTR (Centre for Speech Technology Research).
Contents |
Step 1: Installation
Festival is in the extra repository so:
# pacman -S festival
You will also need to install one or more voices because by default there is no voice to speak with.
Step 2: Add voices
American English
American English male voice `kal' 16kHz version:
# pacman -S festival-kallpc16k
British English
British English male voice `rab' 16kHz version:
# pacman -S festival-rablpc16k
Other voices
Other voices are available for Festival, some of them can be found in AUR.
Step 3: Testing and debugging
To test festival lets make it speak an example text:
$ echo "This is an example. Seems like I'm working fine."|festival --tts
If your hear all the example text below: congratulations, you just installed a TTS system.
If you don't hear anything, something strange or just the beginning of the example sentence continue below.
can't open /dev/dsp
If festival returns the following error message:
Linux: can't open /dev/dsp
Switch to ALSA output by adding these lines to the end of your .festivalrc file, or to /usr/share/festival/festival.scm (source):
(Parameter.set 'Audio_Method 'Audio_Command) (Parameter.set 'Audio_Command "aplay -q -c 1 -t raw -f s16 -r $SR $FILE")
Alsa playing @ wrong speed
If the solution above gives you Mr. Squeaky Voice, you might want to try:
(Parameter.set 'Audio_Method 'Audio_Command) (Parameter.set 'Audio_Command "aplay -Dplug:default -f S16_LE -r $SR $FILE")
... instead.
Configuration & Usage
Interactive Mode (testing voices etc.)
festival has an interactive prompt you can use for testing. Some examples (with sample output)
$ festival [...] festival>
List available voices:
festival> (voice.list) (cstr_us_awb_arctic_multisyn kal_diphone don_diphone)
Set voice:
festival> (voice_cstr_us_awb_arctic_multisyn) #<voice 0x1545b90>
Speak:
festival> (SayText '"test this is a test oh no a test bla test") inserting pause after: t. Inserting pause [...] id _63 ; name t ; id _65 ; name # ; #<Utterance 0x7f7c0c144810>
More:
festival> help "The Festival Speech Synthesizer System: Help
Quit: ctrl+d or
festival> (quit)
Read a text file
festival --tts /path/to/letter.txt
Read a text file to wav
cat letter.txt | text2wave -o letter.wav
Setting default voice
You can set a default voice by adding these lines to the end of your .festivalrc file, or to /usr/share/festival/festival.scm:
(set! default_voice 'voice_us1_mbrola)
You can also set the default voice in: /usr/share/festival/voices.scm You must be root and the voices are at the end of the file. Just switch them around
Applications that can make use of festival
One classic app that can make use of this is ping. Use this script to constantly ping a host, and return ping if success, fail is not:
#!/bin/bash while [ 1 = 1 ]; do ping -c $1 && (echo "Ping" | festival --tts) || (echo "Fail | festival --tts) done
Note that this doesn't really work on multisynth voices, as they take a while to prepare before playing.