Last active
February 6, 2023 01:24
-
-
Save alekssamos/b1f5b4d3d9f392e013e22a3c1f1bb479 to your computer and use it in GitHub Desktop.
Script for auto install speech synt RHVoice for Gnome-Orca screen reader
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 | |
# https://www.shellhacks.com/ru/bash-test-if-file-exists/ | |
# https://habr.com/ru/company/ruvds/blog/325928/ | |
# http://qaru.site/questions/41427/how-to-check-if-a-file-contains-a-specific-string-using-bash | |
# http://blog.richim.org/2011/10/bash.html | |
# Check the script is being run by root | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root" | |
exit 1 | |
fi | |
# https://tuxrider.ru/programmy/rhvoice-sintezator-rechi-dlja-linux/ | |
# Сборка и установка RHVoice. | |
# ◾ создаем папку и заходим в нее | |
if [ ! -d "build" ]; then mkdir build; fi | |
cd build | |
# ◾ устанавливаем программы необходимые для сборки | |
apt-get -q update | |
apt-get -y install git scons g++ libglibmm-2.4-dev libspeechd-dev libpulse-dev pkg-config | |
# ◾ скачиваем синтезатор речи | |
if [ ! -d "RHVoice" ]; then git clone --depth 2 https://github.com/Olga-Yakovleva/RHVoice.git; fi | |
# без --depth он делает медленно, а так быстро | |
# нам сейчас история изменений не нужна | |
if [ ! -d "RHVoice" ]; then exit 2; fi | |
# ◾ заходим в скачанную папку, собираем и устанавливаем | |
cd RHVoice | |
# а дальше он с первого раза не собирается. | |
# обновляем | |
git pull | |
# скачиваем подмодули (голоса) | |
git submodule update --init --progress --depth 2 | |
FILE="/usr/local/bin/sd_rhvoice" | |
# while [ ! -f "$FILE" ] | |
# do | |
# scons | |
## если отдельно scons и затем scons install, | |
## то не работает, | |
## а если сразу scons install, | |
## работает, проверено опытным путём | |
## я и сделал сначала цикл, долго не мог понять | |
scons install | |
ldconfig | |
if [ ! -f "$FILE" ]; then rm -rf ./build/*; fi | |
# done | |
if [ ! -f "$FILE" ]; then echo "! installation error !"; exit 3; fi | |
cp -a "$FILE" /usr/lib/speech-dispatcher-modules | |
# После команды scons начнется процесс сборки, он довольно долгий. Но результат должен выглядеть следующим образом. | |
# Голос установлен. Теперь необходимо настроить операционную систему, чтобы она могла без проблем работать с синтезатором. | |
# ◾ создадим конфигурационный файл | |
# ... | |
# ◾ внесем в него следующие строчки | |
FILE="/etc/speech-dispatcher/modules/rhvoice.conf" | |
echo RHVoiceDataPath "/usr/local/share/RHVoice">$FILE | |
echo RHVoiceConfigPath "/usr/local/etc/RHVoice/">>$FILE | |
echo RHVoicePunctuationMode >>$FILE | |
echo \#RHVoicePunctuationList "@+_">>$FILE | |
echo RHVoiceDefaultVoice "Aleksandr">>$FILE | |
echo RHVoiceDefaultVariant "Pseudo-English">>$FILE | |
echo Debug >>$FILE | |
# ...Теперь внесем изменения в ещё один конфигурационный файл. | |
## ◾ ищем строки где добавляются модули (строка начинается с #AddModule) речевых синтезаторов и добавляем новый модуль | |
FILE="/etc/speech-dispatcher/speechd.conf" | |
LINE="#AddModule \"rhvoice\" \"sd_rhvoice\" \"rhvoice.conf\"" | |
if ! grep -q "$LINE" "$FILE"; then | |
echo "">>$FILE | |
echo $LINE>>$FILE | |
fi | |
# ◾ вот что получается в итоге | |
# Настройка экранного диктора Orca. ... | |
# https://mail.gnome.org/archives/orca-list/2008-June/msg00586.html | |
/etc/init.d/speech-dispatcher restart | |
echo "installation is successful" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
wget -O install_rhvoice.sh https://git.io/J4rVj && chmod +x ./install_rhvoice.sh && sudo ./install_rhvoice.sh