Last active
March 17, 2025 21:32
-
-
Save Davidy22/adde9c3f0a0f32cf732564c826d01f07 to your computer and use it in GitHub Desktop.
Installing Pico on Fedora
This file contains hidden or 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
One day, I woke up and decided I really wanted a program to read books to me while I lie down or do other things. I did some | |
research, installed Calibre and fired away and my ears bled because the default text to speech system on Fedora is espeak, | |
which doesn't have very pleasant voices to listen to. I tried Festival because I saw someone on the internet mention how it | |
had very good sound quality, and I had a blast picking out a voice I liked but when it came to putting it into use there was | |
just the small issue of festival being very slow to generate speech, which led to 5 second gaps between every sentence. The | |
next system I tried was Pico, which I've now settled on because it sounds great and works great, but I am putting pen to | |
paper today because Fedora does not actually have Pico in its repositories and I want to document the arduous journey it took | |
to set Pico as the system's default recognised text to speech engine. Mainly for myself in case I ever need to do this again | |
on a new machine, but also for those to come after me looking for the same thing on Fedora, or for an enterprising packager | |
to take what I've found and get it onto the Fedora repositories. | |
The first step was installation. A script already exists to get the command line program `picospeaker` onto your machine, | |
although a little more needs to be done before the system uses pico by default: | |
https://github.com/carmenfdezb/asterisk-picotts/blob/master/picotts-install.sh | |
After running the script the command `picospeaker` should be installed and runnable with `picospeaker "hello world"` or | |
`echo "hello world" | picospeaker`. This is stil just a standalone command though, Fedora won't use this for the system | |
default TTS when you turn on the accessibility screen reader or try to read books in Calibre though. We need to make the | |
Fedora speech dispatcher use pico, so we need to edit two config files. First `/etc/speech-dispatcher/speedchd.conf` needs | |
two lines modified, change: | |
``` | |
AddModule "espeak" "sd_espeak" "espeak.conf" | |
``` | |
with | |
``` | |
AddModule "pico" "sd_generic" "pico.conf" | |
``` | |
There may already be a line for pico that you just need to uncomment. Make sure that it uses "sd_generic" when you | |
uncomment it. Also replace: | |
``` | |
DefaultModule espeak-ng | |
``` | |
with | |
``` | |
DefaultModule pico | |
``` | |
Then, create a new file at /etc/speech-dispatcher/modules/pico.conf with the contents described in the other attached | |
gist. Finally, there is a sed script that needs to be created at ~/.config/speech-dispatcher/pico that couldn't be | |
included in the pico.conf file because of single quote parsing issues, and it should just contain the line: | |
``` | |
s/([[:alpha:]])\?([[:alpha:]])/\1'\2/g | |
``` |
This file contains hidden or 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
# GenericExecuteSynth is the shell command that should be | |
# executed in order to say some message. This command must | |
# stop saying the message on SIGKILL, otherwise it's useless. | |
# You can use the variables $LANGUAGE, $VOICE, $PITCH and $RATE | |
# which will be substituted for the appropriate value (you | |
# can modify this value, see other parameters). | |
# The command can be split into more lines, if necessary, using '\'. | |
GenericExecuteSynth "echo \'$DATA\' | sed -E -f ~/.config/speech-dispatcher/pico | picospeaker -r $RATE -p $PITCH" | |
GenericCmdDependency "picospeaker" | |
GenericSoundIconFolder "/usr/share/sounds/sound-icons/" | |
# GenericStripPunctChars is a list (enclosed in doublequotes) of | |
# all the characters that should be replaced by whitespaces in | |
# order not to be badly handled by the output module or misinterpreted | |
# by shell. | |
GenericStripPunctChars "~@#$%^&*+=|\\/<>[]_`" | |
# AddVoice specifies which $VOICE string should be assigned to | |
# each language and symbolic voice name. All the voices you want | |
# to use must be specified here. | |
AddVoice "en" "female1" "pico" | |
# If the language you need to pass in $LANG is different | |
# from the standard ISO language code, you can specify | |
# which string to use instead. If you wish to use | |
# other than ISO charset for the specified language, | |
# you can add it's name (as accepted by iconv) as a | |
# third parameter in doublequotes. | |
GenericLanguage "en" "en" | |
# These parameters set _rate_ and _pitch_ conversion. This is | |
# part of the core of the definition of this generic output | |
# module for this concrete synthesizer, it's not intended to | |
# be modified by common users. | |
# The resulting rate (or pitch) has the form: | |
# (speechd_rate * GenericRateMultiply) + GenericRateAdd | |
# while speechd_rate is a value between -100 (lowest) and +100 (highest) | |
# You have to define some meaningful conversion for each synthesizer | |
GenericRateAdd 100 | |
GenericPitchAdd 100 | |
#GenericVolumeAdd 100 | |
# (These values are multiplied by 100, because DotConf currently | |
# doesn't support floats. So you can write 0.85 as 85 and so on.) | |
GenericRateMultiply 5 | |
GenericPitchMultiply 1 | |
#GenericVolumeMultiply 50 | |
# This program is free software; you can redistribute it and/or modify it under | |
# the terms of the GNU General Public License as published by the Free Software | |
# Foundation; either version 2 of the License, or (at your option) any later | |
# version. | |
# | |
# This program is distributed in the hope that it will be useful, but WITHOUT ANY | |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | |
# PARTICULAR PURPOSE. See the GNU General Public License for more details (file | |
# COPYING in the root directory). | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment