The main options are espeak, Gnuspeech, spd-say, MBROLA, PicoTTS and the festvox project which festival and flite are part of. While I found espeak to be the simplest system to use, festival produced the best results when used with the right voices. This post shall outline the various ways festival can be used and the steps required to achieve good results.
Usage
Install festival:
sudo apt-get install festival festvox-us-slt-htsUse festival’s interactive mode:
festival -i
festival> (voice.list)
festival> (voice_cmu_us_slt_arctic_hts)
festival> (SayText "Don't hate me, I'm just doing my job!")
festival> (intro)Run commands from file:
festival> (load "hello.scm")Use festival’s batch mode:
festival -b '(voice_cmu_us_slt_arctic_hts)' \
'(SayText "The temperature is 22 degrees centigrade and there is a slight breeze from the west.")'Use festival’s batch mode to run file:
festival -b hello.scmPipe text into festival’s tts mode:
echo hello | festival --ttsPipe text to festival’s tts mode from Python with subprocess:
from subprocess import PIPE, Popen
text = 'We love Raspberry.'
process = Popen(['festival', '--tts'], stdin=PIPE)
process.stdin.write(text + '\n')
process.stdin.close()
process.wait()Use Python wrapper of festival’s C++ API:
sudo apt install festival-dev
pip install git+https://github.com/krisfris/pyfestivalimport festival
festival.sayText('hello')Festival also has a C, C++ and a client-server API. See API.
Voices
The voice_cmu_us_slt_arctic_hts voice (used above) can be installed easily and isn’t bad but the Nitech HTS voices are better. HTS stands for hidden-markov-model-based speech synthesis system and Nitech is the Nagoya Institute of Technology.
The voices were not available on the original site at the time of writing this post thus I uploaded them to a GitHub repository.
# Clone the github repo with the voices
git clone git@github.com:krisfris/nitech-hts-voices.git
# Enter directory
cd nitech-hts-voices
# Extract files
for t in `ls` ; do tar xvf $t ; done
# Install voices
sudo mkdir -p /usr/share/festival/voices/us
sudo mv lib/voices/us/* /usr/share/festival/voices/us/
sudo mv lib/hts.scm /usr/share/festival/hts.scm
# List all available voices
for d in `ls /usr/share/festival/voices` ; do ls "/usr/share/festival/voices/${d}" ; doneTo set a voice as default voice edit the /etc/festival.scm file and add the following line:
(set! voice_default 'voice_nitech_us_rms_arctic_hts)Note: The Nitech voices are not compatible with festival versions greater than 2.1 which is from 2010. The default festival version on Ubuntu 20.04 is 2.5.
Flite
Flite is a small, fast and more portable (albeit less customizable) speech synthesis engine for festival voices. Install it with sudo apt install flite. Download more voices:
cd
mkdir .config/flite && cd .config/flite
wget -r --no-parent --no-directories --accept flitevox http://www.festvox.org/flite/packed/flite-2.0/voices/
echo "Hello World!" | flite -voice ./cmu_us_axb.flitevoxThe downside is, you can’t use voices from festival with flite directly. Instead you will need to convert them manually which requires time and programming knowledge. See Converting FestVox Voices.
Personally, I would stick to festival unless the speed and small size of flite are actually required.
Emacs
The festival manual mentions a simple way of using festival from emacs. See Emacs interface.
There is also an ubuntu package called eflite which is an emacspeak server based on flite.
Conclusion
Since the Nitech voices don’t work with newer festival versions you will have to settle for the cmu_us_slt_arctic_hts voice. If you don’t mind going commercial, using AWS Polly is likely a better choice.
Links
https://askubuntu.com/questions/53896/natural-sounding-text-to-speech
http://www.cstr.ed.ac.uk/projects/festival/manual/festival_toc.html
https://ubuntuforums.org/showthread.php?t=751169
from Hacker News https://ift.tt/2PnBHME
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.