Added a quick and dirty script to download and optionally register voices from Cepstral.com. This is mostly untested, so only use if you know what you're doing.

This commit is contained in:
Storm Dragon 2021-05-12 02:31:37 -04:00
parent 6bdf01a4c6
commit 0e28266fe3

108
speech/install_cepstral.sh Executable file
View File

@ -0,0 +1,108 @@
#!/usr/bin/env bash
# This script installs Cepstral voices for use with the audiogame-manager
# To purchase a license for a voice you like, visit https://cepstral.com
# This script is released under the terms of the WTFPL: http://wtfpl.net
# Installer files are saved to ~/Downloads
# Dialog accessibility
export DIALOGOPTS='--no-lines --visit-items'
# Make sure display is set in case installed from console.
export DISPLAY="${DISPLAY:-:0}"
register() {
local v="${1##*Cepstral_}"
v="${v%%_*}"
company="$(dialog --inputbox "Company name (leave empty if none)" -1 -1 --stdout)"
customer="$(dialog --inputbox "Customer name" -1 -1)" || exit $?
key="$(dialog --inputbox "License key" -1 -1)" || exit $?
eval "wine \"c:\\Cepstral\\bin\\swift.exe\" --reg-voice --voice-name \"'$v'\" --customer-name \"'$customer'\" --company-name \"'$company'\" --license-key \"'$key'\""
exit 0
}
action="install"
declare -a voices=(
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Allison_windows_6.2.3.801.exe"
"Allison"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Amy_windows_6.2.3.801.exe"
"Amy"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Belle_windows_6.2.3.801.exe"
"Belle"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Callie_windows_6.2.3.801.exe"
"Callie"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Charlie_windows_6.2.3.801.exe"
"Charlie"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Dallas_windows_6.2.3.801.exe"
"Dallas"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Damien_windows_6.2.3.801.exe"
"Damien"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_David_windows_6.2.3.801.exe"
"David"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Diane_windows_6.2.3.801.exe"
"Diane"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Duchess_windows_6.2.3.801.exe"
"Duchess"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Duncan_windows_6.2.3.801.exe"
"Duncan"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Emily_windows_6.2.3.801.exe"
"Emily"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Linda_windows_6.2.3.801.exe"
"Linda"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Robin_windows_6.2.3.801.exe"
"Robin"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Shouty_windows_6.2.3.801.exe"
"Shouty"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Walter_windows_6.2.3.801.exe"
"Walter"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Whispery_windows_6.2.3.801.exe"
"Whispery"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_William_windows_6.2.3.801.exe"
"William"
)
# Get the desired wine bottle
declare -a bottle
for i in $(find ~/.local/wine -maxdepth 1 -type d -not -name 'wine' | sort) ; do
bottle+=("$i" "${i##*/}")
done
export WINEPREFIX="$(dialog --backtitle "Use the up and down arrow keys to find the option you want, then press enter to select it." \
--clear \
--no-tags \
--menu "Select A Wine Bottle" 0 0 0 "${bottle[@]}" --stdout)"
if [[ -z "${WINEPREFIX}" ]]; then
exit 0
fi
if [ "$1" == "-r" || "$1" == "--register" ]; then
action="register"
fi
voice="$(dialog --backtitle "Use the up and down arrow keys to find the option you want, then press enter to select it." \
--clear \
--no-tags \
--menu "Select A voice to $action" 0 0 0 "${voices[@]}" --stdout)"
if [ "$1" == "-r" || "$1" == "--register" ]; then
register $voice
fi
# make sure the ~/Downloads directory exists.
mkdir -p ~/Downloads
if ! [[ -e ~/Downloads/${voice##*/} ]]; then
wget -O ~/Downloads/${voice##*/} "$voice" | dialog --progressbox "Download voice..." -1 -1
fi
# Install the voice
(wine ~/Downloads/${voice##*/} &
xdotool sleep 20 key --delay 75 alt+n key --delay 75 alt+a key --delay 75 alt+n key --delay 75 alt+o key --delay 75 alt+i sleep 20 key --delay 75 alt+f
find "${WINEPREFIX}/drive_c/Program Files/Cepstral/voices" -type d -not -name voices -exec bash -c 'for d ; do echo "GAIN 2.5" > "$d/default.sfx";done' _ {} \;) | dialog --progressbox "installing voice..." -1 -1
exit 0