Last active
September 2, 2018 05:40
-
-
Save John-Appleseed/e889f3bc31dd4e1643a29dfe6002350f to your computer and use it in GitHub Desktop.
Linux Speech Install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# speech.install: | |
speech.install(){ | |
# requires package libncurses5-dev xsel | |
# Tested on amd64, arm64 | |
# Issue: festival's `make symlinks` are the full build path to binaries and configs rather than a relative path | |
# Currently festival/ is extracted out of build_festival/ into $usr_share_dir/ with the voices installed and the festival binaries and configs relinked to $usr_share_dir by a 2nd full recompilation. make clean && ./configure && make | |
# Either change github.com/festvox/festival symlinks to relative or revise setup_festival_mbrola.sh to install voices to target path | |
# TODO quickfix: setup_festival_mbrola.sh festival-mbrola-voices should have working directory ($work_dir) and target directory ($target_dir) for the voices to be installed in the target $usr_share_dir/festival folder. | |
LAB="${LAB-:"$HOME/Lab"}" | |
mkdir -p "$LAB/speechtools" | |
cd "$LAB/speechtools" | |
work_dir="." | |
usr_share_dir="/usr/local/share" | |
#usr_share_dir="/usr/share" | |
echo "Building festival and speech_tools" | |
curl -O https://raw.githubusercontent.com/John-Appleseed/setup-festival-mbrola/master/setup_festival_mbrola.sh | |
#bash setup_festival_mbrola.sh "$usr_share_dir" festival # TODO: Install in destination | |
bash setup_festival_mbrola.sh "$work_dir" festival | |
bash setup_festival_mbrola.sh "$work_dir" mbrola | |
# Download, Setup, and Move the voices into festival | |
bash setup_festival_mbrola.sh "$work_dir" festival-mbrola-voices | |
echo "Installing festival and speech_tools to $usr_share_dir/" | |
sudo mv "$work_dir/build_festival/speech_tools" "$usr_share_dir/" # speech_tools not needed for festival runtime. Need for festival recompile | |
# Move festival to its destination | |
sudo mv "$work_dir/build_festival/festival" "$usr_share_dir/" | |
echo "Installing mbrola to /usr/bin" | |
sudo mv "$work_dir/build_mbrola/mbrola" /usr/bin/ | |
# TODO: reduce the extra recompile by editing setup_festival_mbrola.sh to install voices to target festival without the setup files | |
cd "$usr_share_dir/festival" | |
make clean && ./configure && make | |
echo "Recompiled: festival binary relinked correctly to $usr_share_dir/festival" | |
#./configure && make && make make_library | |
echo "Add $usr_share_dir/festival/bin to \$PATH" | |
echo "export PATH="$usr_share_dir/festival/bin:\$PATH"" | |
export PATH="$usr_share_dir/festival/bin:$PATH" | |
#export PATH="`pwd`/$work_dir/build_mbrola:$PATH" | |
echo "Linking $usr_share_dir/festival/bin/festival to /usr/local/bin/" | |
sudo ln -s $usr_share_dir/festival/bin/festival /usr/local/bin/ | |
echo -e "\n\n" | |
echo "Hello World! Mic Check" | |
echo "Hello world! This is the festival kal_diphone American English voice. Open the pod bay doors, dave" | padsp festival --tts --pipe | |
echo "" | |
echo "Change default voice: edit $usr_share_dir/festival/lib/voices.scm" | |
echo "Recommended voices: en1_mbrola, rab_diphone, don_diphone, us2_mbrola" | |
echo "Change voice speed: edit $usr_share_dir/festival/lib/voices/english/kal_diphone/festvox/kal_diphone.scm" | |
echo "Set voice speed: Duration_Stretch 0.65" | |
} | |
# --- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# padsp festival to use the pulseaudio soundserver | |
# aoss festival to use the alsa soundserver | |
# Speak selected text | |
xsel | padsp festival --tts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
speech.install:
One stop command to install Text To Speech for Linux on amd64 and arm64 (46 minutes to install on RPI2).
speech.install
installs thefestival
command with a simple set of english and american voices.Distro festival is currently broken on both apt-get and emerge
Recently, Dec 25, 2017, festival 2.5 was release with support for GCC 6.2.0 along with a fix for the threading issue, and invalid memory access seg faults, thank you Devs!
Install
To get started, download gist,
source speech_install.sh
, and runspeech.install
to get the festival 2.5 goodnesshttps://gist.github.com/John-Appleseed/e889f3bc31dd4e1643a29dfe6002350f
Activate Text To Speech by echoing text via pipe or by reading txt files with the command
festival --tts
echo "Hello World. Festival is alive and well" | padsp festival --tts
festival --tts hello_world.txt
Text To Speech
To complete the festival TTS experience install tts.sh to enable text selection speech via keyboard shortcut
Setup the TTS keyboard shortcut as super + esc to
/usr/local/bin/tts.sh
MacOS has the TTS (Text To Speech) command as option + esc. For Linux, option + esc is for window switching, so control or super + esc works for Text To Speech
With MATE, Menubar > System > Preference > Hardware > Keyboard Shortcuts > + Add new
With Gnome, Activity Menu > Settings > Keyboard > + Add new
Now that you have Text To Speech selection installed, select your text on any webpage or pdf, press super + esc and enjoy the reading festival!