Re: How Can I Switch Synthesizers on the Fly?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Well Chime_and_all, let me chime in.

1. Slint doesn't ship the talkwith script, but a different one, named speak-with.

2. talkwith can be found in the archive provided here:
ftp://linux-speakup.org/pub/speakup/speakup-3.1.6.tar.bz2
in the tools directory

I ran talkwith here (in a yet to be released Slint64-15.0) and it still works.
I attach a copy of the script.

I having both espeakup and speechd-up installed, As in the kernel I run
currently has the speakup drivers provided as modules, I first typed as root:
mopdrobe speakup_soft # this also loads the speakup module as a dependency
then to start espeakup:
talkwith soft espeakup
then to start speechd-up
talkwith spd
then to start a my (non existing) Dec Talk:
modprobe speakup_dectlk
talkwith dectlk
All worked, but I can't check the last command as I do not owning such hardware.

So no need to fiddle manually with /sys if you use talkwith.

I can't help with installating speechd-up in Debian that I do not use.

PS I also typed:
tcsh talkwith soft espeakup
which displayed:
Illegal variable name
So Chime, I know that tcsh is the shell you are used to, but you certainly would
do us a favor typing your commands from another one before requesting help.

Here I use the bash shell, you could probably use ash or dash as well.

Cheers,
Didier


Le 04/04/2022 à 02:37, Gregory Nowak a écrit :
> On Sun, Apr 03, 2022 at 12:36:25PM -0700, Chime Hart wrote:
>> last year I purchased some hi quality voices from Oralux, which are software
>> speech. When I have Allison installed, I can send her text through spd-say.
>> Making matters more complex, speech-dispatcher will not seem to install on
>> this Debian Sid machine.
> 
> This is contradictory. Having spd-say working implies a working and
> installed speech-dispatcher. So, I will assume you have
> speech-dispatcher installed and spd-say installed and working on one
> machine, but not another. In that case saying speech-dispatcher won't
> install doesn't help us help you.
> 
>> Guidance I've received from 2 sources, says I must
>> install and have espeak talking before I can switch to Allison, which is an
>> embedded voice.
> 
> If these voices interface through speech-dispatcher, then that would
> make sense. However, the only way I know of to interface speakup to
> speech-dispatcher right now is through speechd-up. So, it seems like
> you would have to install speechd-up, get that working with
> speech-dispatcher and espeak-ng, and once you have that working get
> speech-dispatcher to use your purchased voices.
> 
>> When I was running Slint on a laptop, Didier had created a
>> talk-with command to easily switch synths, but his script would need to be
>> re written for Debian.
> 
> I can confirm the talkwith provided in the speakup-tools package for
> debian bullseye seems to be broken. Issuing talkwith soft comes back
> with:
> 
> /usr/sbin/talkwith: 88: shift: can't shift that many
> 
> I took a look at the script, but don't see where the problem is.
> 
>> In addition, if I unload the DecTalk module, I won't
>> have speech, or would their be a way of having both DecTalk and software
>> speech at the same time?
> 
> No, you can't have both your dectalk and software speech at the same time.
> 
>> So, can some1 please provide exact commands I can
>> switch synths on the fly? I ran a locate for softsynth  but nothing found.
> 
> No surprise. What you want is the speakup_soft module. You would as
> root load that with:
> 
> modprobe speakup_soft
> 
> then start espeakup or speechd-up, depending on which one you use. I
> think that would be something like:
> 
> systemctl speechd-up start
> or
> systemctl espeakup start
> 
> I'm not a systemd user, so someone else can correct the above if
> they're not correct.
> 
> Now, assuming you have both speakup_soft and speakup_dectlk kernel
> modules loaded, you can switch between them as root with:
> 
> echo dectlk >/sys/accessibility/speakup/synth
> 
> for the dectalk, and
> 
> echo soft >/sys/accessibility/speakup/synth
> 
> for software speech. Remember that before switching to dectlk you
> should stop espeakup or speechd-up, and after switching to soft you
> should start espeakup or speechd-up. I seem to recall you use csh, so
> maybe someone can roll all that into a csh script for you.
> 
> Greg
> 
> 
#!/bin/sh
# 
# talkwith -- switches speakup synthesizers on the fly
# 
# Copyright (c) 2009 by  the Speakup Team
# Copyright (c) 2008, 2009 by  Charles Hallenbeck
# 
#  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.
#
#  You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Requirements: Linux speakup 3.1.0 or later
#
# To install, copy this script to a directory on the execution path
# e.g. /usr/sbin, or /usr/local/sbin.
# This script should be run as root.

# be sure we are root
if [ $(id -ru) -gt "0" ]; then
	echo "$(basename $0) must be run as root."
	exit
fi

# Define some variables
SPEAKUPDIR="/sys/accessibility/speakup"

# make sure speakup is loaded
if [ ! -d $SPEAKUPDIR ]; then
	echo "Speakup does not seem to be installed."
	exit
fi

# Check the command line for options

if [ "$1" = "" ]; then
	echo
	echo "Usage: $(basename $0) <synth> <daemon> [options]"
	echo
	echo "synth - any synthesizer supported by speakup"
	echo
	echo "daemon - for the 'soft' synthesizer, this should be either"
	echo "spd for speechd-up, or espeakup to run espeakup."
	echo "For the other synthesizers, this is ignored."
	echo
	echo "options - for a software synthesizer, the rest of the command line"
	echo "is passed on to the daemon; otherwise it is ignored."
	echo
	echo "Talkwith does not install or remove modules, so make sure any"
	echo "required driver modules are installed or built into the kernel"
	echo "before running talkwith."
	echo
	exit
fi
 
NEWMOD=$1
shift

# for backward compatibility
if [ "$NEWMOD" = "spd"  -o "$NEWMOD" = "espeakup" ]; then
	DAEMON=$NEWMOD
	NEWMOD=soft
fi

if [ "$NEWMOD" = "soft" ]; then
	if which espeakup > /dev/null 2>&1 ; then
		HAVE_ESPEAKUP=1
	fi
	if which speechd-up > /dev/null 2>&1 ; then
		HAVE_SPD=1
	fi
			
	if [ -z "$HAVE_ESPEAKUP"  -a -z "$HAVE_SPD" ]; then
		echo "no software speech synthesizers are installed."
		exit
	fi
			
	if [ -z "$DAEMON" ]; then
		DAEMON=$1
		shift
	fi

	if [ -z "$DAEMON" -a ! -z "$HAVE_ESPEAKUP" ]; then
		DAEMON="espeakup"
	elif [ -z "$DAEMON" -a ! -z "$HAVE_SPD" ]; then
		DAEMON="spd"
	fi
	
	if [ "$DAEMON" = "espeakup" -a -z "$HAVE_ESPEAKUP" ]; then
		echo "espeakup does not appear to be available."
		exit
	elif [ "$DAEMON" = "spd" -a -z "$HAVE_SPD" ]; then
		echo "speechd-up does not appear to be available."
		exit
	fi
fi

OLDMOD="$(cat $SPEAKUPDIR/synth)"
echo "$NEWMOD" > $SPEAKUPDIR/synth 2> /dev/null
if [ $? != 0 ]; then
	echo "Unable to switch to the $NEWMOD synthesizer."
	echo "This means that the driver is not built in, the module"
	echo "is not loaded, or $NEWMOD is not a valid synthesizer."
	exit 1
fi

if [ "$OLDMOD" = "soft" ]; then
	if [ -f /var/run/espeakup.pid ]; then
		kill $(cat /var/run/espeakup.pid) 2> /dev/null
		if [ -f /var/run/espeakup.pid ]; then
			rm -f /var/run/espeakup.pid
		fi
	fi
	if [ -f /var/run/speechd-up.pid ]; then
		kill $(cat /var/run/speechd-up.pid) 2> /dev/null
		if [ -f /var/run/speechd-up.pid ]; then
			rm -f /var/run/speechd-up.pid
		fi
	fi
	sleep 2
fi

if [ "$NEWMOD" = "none" ]; then
	exit
elif [ "$NEWMOD" = "soft" ]; then
	if [ "$DAEMON" = "espeakup" ]; then
		espeakup $*
	elif [ "$DAEMON" = "spd" ]; then
		nice -n 5 speechd-up $*
	fi
fi

[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]

  Powered by Linux