# [SOUND] speechd lets your Computer speak

## Tobi 2.4.20

Hi!

This is how I set up speechd:

1. Become root

```
# su -
```

2. emerge needed Packages

```
# emerge speechd
```

3. Init-Script:

```
# vi /etc/init.d/speechd
```

and fill with:

```
#!/sbin/runscript

 

start() {

        ebegin "Starting speechd"

        start-stop-daemon --start --quiet --pidfile /var/run/speechd.pid --exec

/usr/bin/speechd

        eend $? "Failed to start speechdd"

}

 

stop() {

        ebegin "Stopping speechd"

        start-stop-daemon --stop --quiet --pidfile /var/run/speechd.pid

        eend $? "Failed to stop speechd"

 

        # clean stale pidfile

        [ -f /var/run/speechd.pid ] && rm -f /var/run/speechd.pid

}

 

restart() {

        stop

        start

}
```

4. make init-script executable

```
# chmod 755 /etc/init.d/speechd
```

5. if you want to come up speechd at boottime type:

```
# rc-update add speechd default
```

6. start speechd

```
# /etc/init.d/speechd start
```

7. Test:

```
# echo "Hello World" > /dev/speech
```

This works for me, and it's fun! I think the init-script isn't perfect, if anybody could post a better one, I would be happy.

For those of you who would like to hear a female voice, follow these additional steps:

8. emerge needed packages

```
# emerge mbrola
```

9. edit the voices scheme

```
# vi /usr/lib/festival/voices.scm
```

10. search for "us1_mbrola" and put it in top of the list and save the file.

Before:

```

'(kal_diphone

    ked_diphone

    don_diphone

    rab_diphone

    en1_mbrola

    us1_mbrola

    us2_mbrola

    us3_mbrola

    gsw_diphone  ;; not publically distributed

    el_diphone)

```

After:

```

'(us1_mbrola

    kal_diphone

    ked_diphone

    don_diphone

    rab_diphone

    en1_mbrola

    us2_mbrola

    us3_mbrola

    gsw_diphone  ;; not publically distributed

    el_diphone)

```

11. Test female:

```
# echo "(SayText \"Hello World\")" | festival
```

(Note: #echo "Hello World" > /dev/speech will not work for female voice!)

That's it so far...

See ya, Tobi

----------

## bsolar

You might want to commit that to bugzilla.  :Wink: 

----------

## Ivion

Is there also a way to let the 'voice' sound different? Like changing it to a woman's voice?  :Smile: 

----------

## barlad

I can't seem to be able to load festival in server mode to have speechd workds... keeping getting a "bind failed" error  :Sad: 

I think you can change the voice in Festival btw

----------

## Tobi 2.4.20

 *bsolar wrote:*   

> You might want to commit that to bugzilla. :wink:

 

Do you mean the init-script? I've written it by myself and I'm not sure if it's ok, or not.

----------

## Ante

Damn, this is hot  :Very Happy:  Extremley funny, gonna add this to my /etc/init.d/issue.

As mentioned, is it possible to change to voice?

EDIT: echo "Welcome to this Gentoo/Linux box of power, feel free to enjoy your self" > /dev/speech

----------

## Vagabond

Hmm, I can't get speechd to talk by echoing to /dev/speech but I can get festival to manually speak by using (SayTest "blah") after initalizing festival.

Any ideas?

Vag

----------

## barlad

Ya, check /var/log/speechd.

Most likely, it will tell you that it cannot connect to festival server.

Then stop the speechd service, try to run 

```
festival --server
```

See if it works, then run speechd again. It should work. If it does not, check again /var/log/speechd and see what's wrong.

Right now I can't run the festival server, it says something like "binding failed". I think there is something to set up somewhere so festival is allowed to use port 1034 and speechd is allowed to connect to it.

If you find... let me know please  :Wink: 

----------

## Vagabond

Yeah, I get the same error, damn.

Vag

----------

## link97381

Ya I get a "socket: bind failed" error.....anyone know how to fix it?

----------

## Lockup

if only we could use the at&t voices with that...

----------

## Tobi 2.4.20

 *Ante wrote:*   

> Damn, this is hot :D Extremley funny, gonna add this to my /etc/init.d/issue.
> 
> As mentioned, is it possible to change to voice?
> 
> EDIT: echo "Welcome to this Gentoo/Linux box of power, feel free to enjoy your self" > /dev/speech

 

Hi dudes!

I've added a method how to let your computer speak like your girlfriend...just follow steps eight to ten!

See ya, Tobi

----------

## TheCoop

that is absolutly wonderful, thankyou, how about including the rc script in the ebuild?

----------

## Tobi 2.4.20

 *TheCoop wrote:*   

> that is absolutly wonderful, thankyou, how about including the rc script in the ebuild?

 

How do I do this? Is their any HowTo, man-page, whatever where ebuild-hacking is explained?

And: I think the script isn't quiet perfect, e.g. when you make # /etc/init.d/speechd restart their is some curious error I can't cope with.

----------

## bassvandijk

This is really cool!!!

Also nice:

forune > /dev/speech

or

dmesg > /dev/speech

----------

## bassvandijk

I have a weird problem:

When I do:

echo "Hello world" > /dev/speech

festival says "Hello world" but it says it way too fast.

Like playing a LP too fast...

----------

## bassvandijk

I solved the problem!

http://www.cstr.ed.ac.uk/cgi-bin/lists.cgi?config=festival_faq&entry=arunning_festival/speed.html

----------

## bassvandijk

If you rc-update this script to your default runlevel then your computer will greet you while booting and it will say goodbey when you halt.

Of course you will need the speechd rc-script also.

If you don't have fortune then just cut the fortune line out.

audio_message

```

#!/sbin/runscript

#

# rc-script to let your gentoo-box speak at boot or halt time.

#

# Bas van Dijk basvandijk@home.nl

#

depend() {

        need speechd

}

start() {

        ebegin "Playing login audio message"

        date="$(date +%H)"

        user="$(whoami)"

        if [ "$date" -ge "6" -a "$date" -le "12" ]

        then

                say "Good morning $user"

        else

                if [ "$date" -gt "12" -a "$date" -le "18" ]

                then

                        say "Good afternoon $user"

                else

                        if [ "$date" -gt "18" -a "$date" -le "24" ]

                        then

                                say "Good evening $user"

                        else

                                if [ "$date" -gt "0" -a "$date" -lt "6" ]

                                then

                                        say "What are you doing up so late $user"

                                fi

                        fi

                fi

        fi

        say "Please pay attention to a few words of wisdom..."

        say "$(fortune)"

}

stop() {

        ebegin "Playing logout audio message"

        say "Thank you for using Gentoo Linux."

        say "Good by and farewell $(whoami)."

}

```

You will also need to this bash script: 

/bin/say

```

#/bin/bash

if [ -e "/dev/speech" ]

then

    echo "$1"

    echo "$1" > /dev/speech

else

    echo "Error! speechd not loaded!"

fi

```

BTW:

In the speechd script, festival doesn't get closed while stopping the service. So you will need to put a killall festival in the stop() function.

----------

## pubecon

so how do you set up the festival server so you don't get the binding error?

----------

## papabean

I couldn't get redirection to /dev/speech working for me without sounding like a chipmunk on methamphetamines, but what did work after following the directions above was this:

```
echo "Hello World" | festival --tts -
```

or:

```
fortune | festival --tts -
```

Hope this helps anyone else.

----------

## Chewie

Hehe this is really cool, thanks dude.   :Very Happy: 

----------

## Yinchie

 *bassvandijk wrote:*   

> If you rc-update this script to your default runlevel then your computer will greet you while booting and it will say goodbey when you halt.
> 
> Of course you will need the speechd rc-script also.
> 
> If you don't have fortune then just cut the fortune line out.
> ...

 

Kewl, thanks for this.

Going to try this out!  :Very Happy: 

----------

## Ian

 *bassvandijk wrote:*   

> I solved the problem!
> 
> http://www.cstr.ed.ac.uk/cgi-bin/lists.cgi?config=festival_faq&entry=arunning_festival/speed.html

 

it says to change a file in "festival/lib" but i have one problem  :Smile: 

can someone tell me where festival/lib is?  heh, i know it probably sounds stupid, but i got everything to work (including the login/logout scripts), except that it's all highpitched/doublespeed.

i must say, even though this is the last thing i ever needed for my home server/linux experiment computer, it's probably the damn coolest thing on the computer  :Razz: .

one slight problem i noticed with the stop script to say goodbye when halting, it takes long enough that  speechd cannot be shutdown.  i'm not sure if this is a problem, or if there's a way to pause the shutdown for a few seconds, so it can shutdown speechd correctly, but that's one thing that should probably be considered.  then again, it might not matter, i'm not sure.

----------

## papabean

 *Ian wrote:*   

> it says to change a file in "festival/lib" but i have one problem 
> 
> can someone tell me where festival/lib is?  heh, i know it probably sounds stupid, but i got everything to work (including the login/logout scripts), except that it's all highpitched/doublespeed.
> 
> 

 

Sure.  It's located in /usr/lib/festival/.  I had to create the siteinit.scm file manually and emerge sox, but it works wonderfully now.

----------

## Gnufsh

For some reason I get this:

# /etc/init.d/speechd start

 * ERROR:  "/etc/init.d/speechd" has syntax errors in it; not executing...

----------

## Ian

ack

when booting with the "audio greeting script" it seems to hang my boot proccess.  error as follows...

```
/sbin/runscript.sh: line 17: command userroot: not found

```

any ideas?

<edit>

<3 knoppix

found my knoppix cd, mounted the hard drive, chrooted to /mnt/hde3 (i have an ultra 100 card), and deleted the script  from the rc_update thing (don't know it's real name, i'm only a n00b!  :Razz: ).  booted back into gentoo, problem solved.

if you can't tell, i'm very proud that i did that all by myself, as two weeks ago, i wouldn't have been able to  :Smile: 

this still leaves a question as to why the script was halting though.  any ideas on that?

</edit>

----------

## DefconAlpha

Why not boot with your Gentoo Stage 1 x86 CD then?

:)

----------

## Ian

i had no idea where the gentoo one is, as i've had trouble with RC2 and RC3, and the RC1 disc was no where to be seen.  knoppix on the other hand, was sitting in my backpack, so i grabbed that and everything worked  :Smile: 

----------

## peepsalot

Can anyone figure out a way to make /dev/speech use the mbrola voice(or any other voice for that matter)?

As far as I can tell speechd is relatively small script that just creates the speech device file and somehow assigns festival to it. So it seems like there should be a way to modify it to make it use the different voices available to festival.  I looked through it but couldn't find any obvious simple hack to do it, but then again I don't really know how to write scripts like that.  :Confused: 

Maybe some of you advanced script hackers could figure it out?

Or if anyone could suggest some good script writing tutorials/lessons I would be interested in knowing about them.  Then maybe eventually I could understand exactly how speechd works, and figure it out on my own.   :Smile: 

----------

## Hiryu

 *Quote:*   

> Can anyone figure out a way to make /dev/speech use the mbrola voice(or any other voice for that matter)? 

 

Yes...

vi /usr/lib/festival/festivalrc

uncomment (set! voice_default 'voice_us1_mbrola)

 (Or add it if it's not there)

----------

## red_over_blue

Can I change the volume just for the voice?  I am usually listening to streaming audio with xmms, and the voice is way too quiet.  I couldn't find anything in the man pages or in the doc directory about volume.

I found the two methods in the faq on the festival site, but neither seem to have any effect.  Also, uncommenting the line that should change to the female voice also does nothing, even after restarting the speechd script.  What do I have to do to have my changes take effect?

Thanks... this is pretty cool.

----------

## red_over_blue

Ok, I got it sorted out.  I just had to read a little more carefully and see that the "stop" function in the script would not kill festival.  I just added a "killall -9 festival" to the stop portion of the script and started the daemon again.

It is now working perfectly... thank again for the tip.

----------

## fith

 :Laughing:   It's coooooool!

Thank you, dude.

----------

## aardvark

 *Gnufsh wrote:*   

> For some reason I get this:
> 
> # /etc/init.d/speechd start
> 
>  * ERROR:  "/etc/init.d/speechd" has syntax errors in it; not executing...

 

same here. no idea!

----------

## aardvark

 *Gnufsh wrote:*   

> For some reason I get this:
> 
> # /etc/init.d/speechd start
> 
>  * ERROR:  "/etc/init.d/speechd" has syntax errors in it; not executing...

 

same here. no idea!

----------

## panserg

```

# emerge media-sound/festival

Calculating dependencies ...done!

>>> emerge (1 of 1) media-sound/festival-1.4.2-r3 to /

/usr/sbin/ebuild.sh: line 865: /var/tmp/portage/festival-1.4.2-r3/work/speech_tools/eclass-debug.log: No such file or directory

>>> md5 ;-) festival-1.4.2-release.tar.gz

>>> md5 ;-) festlex_CMU.tar.gz

>>> md5 ;-) festlex_OALD.tar.gz

>>> md5 ;-) festlex_POSLEX.tar.gz

>>> md5 ;-) festvox_don.tar.gz

>>> md5 ;-) festvox_ellpc11k.tar.gz

>>> md5 ;-) festvox_kallpc16k.tar.gz

>>> md5 ;-) festvox_kedlpc16k.tar.gz

>>> md5 ;-) festvox_rablpc16k.tar.gz

>>> md5 ;-) festvox_us1.tar.gz

>>> md5 ;-) festvox_us2.tar.gz

>>> md5 ;-) festvox_us3.tar.gz

>>> md5 ;-) speech_tools-1.2.2-release.tar.gz

>>> md5 ;-) festdoc-1.4.2.tar.gz

/usr/sbin/ebuild.sh: line 865: /var/tmp/portage/festival-1.4.2-r3/work/speech_tools/eclass-debug.log: No such file or directory

/usr/sbin/ebuild.sh: line 1171: /var/tmp/portage/festival-1.4.2-r3/work/speech_tools/environment: No such file or directory

```

 :Sad: 

----------

## panserg

 :Embarassed: 

There is a bug, and there is a fix there  :Very Happy: 

----------

## grafty

 *Hiryu wrote:*   

>  *Quote:*   Can anyone figure out a way to make /dev/speech use the mbrola voice(or any other voice for that matter)?  
> 
> Yes...
> 
> vi /usr/lib/festival/festivalrc
> ...

 

Another way to do this is to put this in your /root/.festivalrc file:

```
(set! voice_default 'voice_mwm_diphone)
```

replace mwm_diphone with whatever voice you want to use.[/code]

----------

## theJPster

This is all really cool stuff.

I made up the following quick script, which might prove useful to someone (needs lm_sensors installed and setup):

```

#!/bin/bash

# This is /usr/local/bin/saytemp

temp=`/usr/bin/sensors | grep temp2 | sed -r 's/^temp2:.+\+([0-9\.]+).*limit.*$/\1/g'`

if [ -e /dev/speech ]

then

        echo "C P U is at $temp degrees" > /dev/speech;

else

        echo "Speech FIFO /dev/speech does not exist";

fi

```

'temp2' happens to be my CPU temp. I've not edited sensors.conf much  :Smile:  The regex is ugly, but it works!

----------

## edge3281

This is really great!! I love this but...  Is there anyway to get this to work applications in X.  Like in mozilla... say highlighting text and rightclicking on it and having it read to you?  Or in gaim saying somone logged on?  If you know of anything like that let us know.

Thanks

----------

## MrTwister

hi,

how can i redirect the output over arts ?? i sometimes get the following output:

echo "Hello World" | festival --tts - 

Linux: can't open /dev/dsp

----------

## m33sb3w

 *edge3281 wrote:*   

> This is really great!! I love this but...  Is there anyway to get this to work applications in X.  Like in mozilla... say highlighting text and rightclicking on it and having it read to you?  Or in gaim saying somone logged on?  If you know of anything like that let us know.

 

For gaim, you can use buddy pounce and assign a command to it.  A very good thing about this is you set the command for each user separately.  This means that you can say something like "Person A is online" for person A, "Person B is online" for person B, and so on.  You'll know exactly who came online without even looking instead of just knowing that someone came online.

I have a few vague ideas for possibly doing what you want in mozilla (which is a really cool suggestion, by the way).  Maybe I'll try working on that later tonight.

----------

## edge3281

 *m33sb3w wrote:*   

>  *edge3281 wrote:*   This is really great!! I love this but...  Is there anyway to get this to work applications in X.  Like in mozilla... say highlighting text and rightclicking on it and having it read to you?  Or in gaim saying somone logged on?  If you know of anything like that let us know. 
> 
> For gaim, you can use buddy pounce and assign a command to it.  A very good thing about this is you set the command for each user separately.  This means that you can say something like "Person A is online" for person A, "Person B is online" for person B, and so on.  You'll know exactly who came online without even looking instead of just knowing that someone came online.
> 
> I have a few vague ideas for possibly doing what you want in mozilla (which is a really cool suggestion, by the way).  Maybe I'll try working on that later tonight.

 

Great idea!  I didn't think about the executing a command option in gaim.  It works wonderfully now.  Thanks!

----------

## pregopresto

 *Quote:*   

> For some reason I get this: 
> 
> # /etc/init.d/speechd start 
> 
>  * ERROR: "/etc/init.d/speechd" has syntax errors in it; not executing...

 

Please make sure, that you have a blank line at the end of the script. Then it works  :Very Happy: 

HTH

	Prego  :Smile: 

----------

## bassvandijk

 *MrTwister wrote:*   

> hi,
> 
> how can i redirect the output over arts ?? i sometimes get the following output:
> 
> echo "Hello World" | festival --tts - 
> ...

 

This explains how you can use a different audio player for festival. If you run the audio player through "artsdsp" then it should solve your problem.

----------

## STEDevil

Festival supposedly doesn't work with gcc 3.2.2

http://www.cstr.ed.ac.uk/cgi-bin/lists.cgi?config=festival_faq&entry=installing_festival/agcc32.html

Is everybody here that has been able to get it working using an outdated compiler? In that case I wish I'd know 45 minutes ago before I started wasting time with this  :Very Happy: 

----------

## puke

 :Question:  Can this use the pc-speaker?

I have a server that sits in the corner without a monitor, I would like it to talk when there are problems, but I don't want to have to load sound drivers etc.

----------

## riggagoogoo

This is great however is there a way to integrate it in to apps i.e in the kde copy to option could you copy a text file to /dev/speech or perhaps the contents of the clipboard etc - would be great to be able to drag your email to an icon on the desktop and have it read it out.

Rigga

----------

## machinelou

 *STEDevil wrote:*   

> Festival supposedly doesn't work with gcc 3.2.2
> 
> http://www.cstr.ed.ac.uk/cgi-bin/lists.cgi?config=festival_faq&entry=installing_festival/agcc32.html
> 
> Is everybody here that has been able to get it working using an outdated compiler? In that case I wish I'd know 45 minutes ago before I started wasting time with this 

 

Does anyone know if there's a fix to this?  I keep getting errors when compiling festival but I'm sure somebody has a fix. ty

----------

## BradB

OK, now for an interesting use of /dev/speech - where abouts would be fun places to symlink it to?  

ie ln -s /dev/null with /dev/speech - (urg I'd think)

or could you hook it up so that kernel logs got spoken out?

Probably annoying, but maybe fun  :Smile: 

Brad

----------

## panserg

 *BradB wrote:*   

> could you hook it up so that kernel logs got spoken out?
> 
> Probably annoying, but maybe fun 

 

I've hooked to speak the Subject and From fields for all my incoming email. But make sure you do it AFTER you filter spam out  :Smile: 

----------

## riggagoogoo

 *Quote:*   

> 
> 
> I've hooked to speak the Subject and From fields for all my incoming email. But make sure you do it AFTER you filter spam out 
> 
> 

 

How did you do this???

----------

## panserg

 *riggagoogoo wrote:*   

>  *Quote:*   
> 
> I've hooked to speak the Subject and From fields for all my incoming email. But make sure you do it AFTER you filter spam out 
> 
>  
> ...

 

Do you know procmail or maildrop or any mail-filtering program? 

The idea is that when it is filtering a message, it remembers Subject and From (and/or other) fields in variables and then calling a simple shell script with arguments from those variables. The shell script takes arguments, formats the final text message based on stings from arguments and pass it to festival. 

A mail filter script is very specific to mail-filtering program you use. It's also specific to what exactly you are doing when filtering your messages. The shell script is specific to what final output do you want to hear.

I had it before with procmail/sendmail on RH. You bet it's gone. Now I am going to reimplement it it with maildrop/postfix on Gentoo. If (in case of more free time) I'll do it as a generic script (not specific to my needs, but customizable for them) then I'll submit the portage commit request in Bugzilla. otherwise I can forward my script to you privately.

----------

## Oopsz

 *puke wrote:*   

>  Can this use the pc-speaker?
> 
> I have a server that sits in the corner without a monitor, I would like it to talk when there are problems, but I don't want to have to load sound drivers etc.

 

try patching this oss driver into your kernel

 :Smile: 

----------

## beza1e1

I just want to say thanks for this tip  :Smile: 

It is so nice, if your PC wishes you a good night ...

----------

## nephros

thanks, that thing is way cool.

God, this reminds me of old Amiga times!

Now, anyone know how to set up other languages.

I downloaded the German deX packages, and unzipped them to /usr/lib/mbrola/voices/german/de{1..5}, 

edited voices.scm to include "de1" on top of the list 

```

(defvar default-voice-priority-list

  '(de1

    en1_mbrola

    ...

```

and edited festivalrc to:

(set! voice_default 'voice_de1)

but that does not work...

----------

## riggagoogoo

panserg 

Sounds quite cool, I would appreciate a copy of your script however if your almost done with an ebuild I will wait till its made available

Cheers

Rigg

----------

## Vi Rocks

There was a startup script called "audio_message" provided earlier on in this thread, which plays a message during the booting and shutting down of gentoo.

But i have a question for it.

According to gentoo manuals the starting and stopping is in alphabetical order of scripts present in /etc/runlevels/default.

I use ALSA for soue. Since "audio_message" comes later in alphabetical order than "alsa", during boot "alsa" startup script runs first and then "audio_message". This is the correct way. But during shutdown alsa shuts down before audio_message so , Even when audio_message's stop fuction is called , there is no sound ?

Any work around for this. Or better still instead of booting, can this be done per user login/logout. ?

thanks

----------

## BeaTtheMeaT666

 *nephros wrote:*   

> thanks, that thing is way cool.
> 
> God, this reminds me of old Amiga times!
> 
> 

 

Me too  :Wink:  I remember calling people on the phone and let the computer talk to them ...

Speechd this is so f***ing fun,

i just edited /etc/syslog.conf and

changed /var/log/messages to /dev/speech .

enjoy,

bobo

----------

## carrett

hey, this is awesome. when i do: echo "Hello world" > /dev/speech

the system just sits there, no sound comes out and i have to ctl-C to stop the command. however, echo "Hello world" | festival --tts -

works perfectly, anybody know how to make the device work?

----------

## riggagoogoo

I had this problem too at first however when i did a kill artsd and ran it again it worked fine (I assume your running arts?).

There is a good post on the board on how to make OSS work with Arts, check it out here:

```

http://forums.gentoo.org/viewtopic.php?t=15110

```

Hope this helps

Rigga

----------

## carrett

i'm not running artsd

thanks though!

----------

## barrowaj

I am having the same problem.  The festival server gives:

```
prophet root # festival --server

socket: bind failed

```

And so therefore speechd cannot connect to it.  I saw people having this problem earlier in this thread but don't beleive anyone posted a solution.  I guess it has something to do with a port not being available, and I know nothing of how ports are configured on linux.

Can someone who has gotten this to work please offer some advice?

----------

## rhodyne

This is fun. I got to messing around with it and I made a few adjustments to the scripts shown here.

1st my /etc/init.d/speechd init script looks like

```
#!/sbin/runscript

start() {

   ebegin "Starting speechd"

   start-stop-daemon --start --quiet --pidfile /var/run/speechd.pid --exec /usr/bin/speechd

   eend $? "Failed to start speechd"

stop() {

   ebegin "Stopping speechd"

   start-stop-daemon --stop --quiet --pidfile /var/run/speechd.pid

   killall festival            # the above pid only references the parent

   eend $? "Failed to stop speechd"

restart() {

   svc_stop                    # gentoo rc-scripts

   sleep 1                     # recommended process 

   svc_start

}
```

Then I added vocal alerts to the local scripts

/etc/conf.d/local.start

```
if [ -e "/dev/speech" ]

then

   say "Gentoo system $HOSTNAME is ready" && sleep 4 && saytime

else

   echo 'Error .. speechd not loaded'

fi
```

and /etc/conf.d/local.stop

```
RUNLV=`runlevel | cut -d ' ' -f 2`

if [ -e "/dev/speech" ]

then

   if [ "$RUNLV" == "0" ]

   then

      say $HOSTNAME is shutting down" && sleep 3

   elif [ "$RUNLV" == "6" ]

   then

      say $HOSTNAME is rebooting now && sleep 3

   else

      echo "Found invalid runlevel"

   fi

else

   echo 'Error .. speechd not loaded'

fi
```

And I removed the text echo from the say script that bassvandijk put in this post earlier because I didn't want it. 

Once I get this all setup this system goes headless.

I'm still working on getting a login/logout response that doesn't generate errors for remote logins.

----------

## rhodyne

Well I can get a global login welcome message by adding some lines to /etc/profile

```
if [ -e "/dev/speech" ]

then

        if [ `/usr/bin/whoami` = 'root' ]

        then

                say "Welcome to $HOSTNAME ROOT"

                say "Please minimize your time logged in this way"

                sleep 6

                saytime

        else

                say "Welcome to $HOSTNAME $(whoami)"

                say "Enjoy your stay"

        fi

else

        echo 'Error .. speechd not loaded'

fi
```

so now I get vocal "warning" that someone is logged in. All vocals happen at the server, of course.

If you have a lot of logins close together you will get errors on some of them; you might want to shorten the speech to something like "$(whoami) logged in". I also like using the /usr/bin/saytime script that festival installs by default to help identify root logins as different.

----------

## OneOfOne

it doesnt compile with gcc-3.3  :Sad: ...

peace

----------

## LGW

OK, it's great. I'm not yet sure what to use it for, but it's great  :Very Happy: 

----------

## nalin

listen to the clipboard (in konqueror):

select klipper->actions enabled

select klipper->configure klipper

  under general tab enable "Replay Actions..."

  under actions tab add an action

    use a regexp like "^[ \n\r\t0-9a-zA-Z]*$"

    right click select add command

    use command "echo %s > /dev/speech"

To give the action and command better names:

nano -w ~/.kde/share/config/klipperrc

change <add action> and <add command> to something like "text" and "say it", klipper needs be restarted to take effect for the values

----------

## wrs4

Hey guys, this is pretty cool.  I decided to see if I could have a little more fun with it.  I wrote the following script to parse out the date and run it; works fine.  The next step is to see if I can't run it from cron for something like an alarm clock.  Anyhow, here is the script.  You'll need Perl's Date::Format module installed to use it:

```

#!/usr/bin/perl

use strict;

use Date::Format;

################################################################################

#

################################################################################

# This script is designed to convert standard date text to something that

# festival can play in a human-recognizable manner.  I could have been fancy

# and used GetOpts to make it more configurable, but I think it does the job

# as-is.  If you have any bug reports, questions, comments, etc. email me at

# william@free.house.cx with "festival script" in the subject line so I know

# what you're talking about :)

#

#   William Sutton

#   william@free.house.cx

#

# This script is licensed as freeware, with no guarantee of fitness for any

# purpose beyond that expressed in the foregoing.

# to see the command we'll execute, run ./script_name 1

my $debug       = $ARGV[0] || 0;

# configure the appropriate binary paths if somewhere else

my $festival    = "/usr/bin/festival";

my $echo        = "/bin/echo";

# We want text in the format of "Day of week, Numeric day Month Year, Hours

# Minutes, Time Zone

my $date_text   = digit2txt (time2str ('%A, %e %B %Y, %H %M, %Z',time));

my $command     = "$echo \"(SayText \\\"$date_text\\\")\" | $festival";

# debug if requested

if ($debug == 1)

{

    print "\n\n";

    print "*** Playing => $command ***\n";

    print "\n\n";

}

# play the text string

qx { $command };

################################################################################

#

################################################################################

sub digit2txt

{

    my $text    = shift;

    # Ordinary human-recognizable speech values rather than, say,

    # "one nine" for "nineteen"

    my %numbers = (

        teens   => [ 'ten','eleven',

                     'twelve','thirteen',

                     'fourteen','fifteen',

                     'sixteen','seventeen',

                     'eighteen','nineteen'

                   ],

        tens    => [ 'twenty', 'thirty',

                      'forty', 'fifty',

                      'sixty', 'seventy',

                      'eighty', 'ninety'

                   ],

        digits  => [ 'one','two',

                     'three','four',

                     'five','six',

                     'seven','eight',

                     'nine'

                   ]

    );

    # if we have a four digit pattern (e.g., the year)

    if ($text =~ /(\d{4})/)

    {

        my ($thousands,$hundreds,$tens,$ones) = split (//, $1);

        # convert thousands to text

        my $new_text = $numbers{digits}[$thousands - 1] . " thousand ";

        # likewise, hundreds if non-zero

        if ($hundreds > 0)

        {

            $new_text .= $numbers{digits}[$hundreds - 1] . " hundred ";

        }

        # recurse and parse the tens portion; I love recursion!

        $new_text .= digit2txt ("$tens$ones");

        # substitute new text for old and exit block

        $text =~ s/$1/$new_text/;

    }

    # if we have a two digit pattern (e.g., hours, minutes)

    elsif ($text =~ /(\d{2})/)

    {

        my ($tens,$ones) = split (//, $1);

        my $new_text;

        # if we have 1-9, ...

        if ($tens == 0 && $ones > 0)

        {

            $new_text = $numbers{digits}[$ones - 1];

        }

        # or if we have 20-99, ...

        elsif ($tens > 1)

        {

            $new_text = $numbers{tens}[$tens - 2];

            if ($ones > 0)

            {

                $new_text .= " " . $numbers{digits}[$ones - 1];

            }

        }

        # or if we have 10-19, ...

        elsif ($tens == 1)

        {

            $new_text = $numbers{teens}[$ones - 1];

        }

        # substitute new text for old and exit block

        $text =~ s/$1/$new_text/;

    }

    # if we still have digits in the text, recurse and parse

    # otherwise, just return

    return ($text =~ /\d+/ ? digit2txt ($text) : $text);

}

```

----------

## wrs4

Got it to cron, going to hunt up the volume docs someone mentioned earlier.  Incidentally, while I was at it, I made a copy of the above script and tweaked it to handle general commands from the command line:

```

#!/usr/bin/perl

use strict;

################################################################################

#

################################################################################

# I could have been fancy and used GetOpts to make it more configurable, but

# I think it does the job as-is.  If you have any bug reports, questions,

# comments, etc. email me at william@free.house.cx with "festival script" in

# the subject line so I know what you're talking about :)

#

#   William Sutton

#   william@free.house.cx

#

# This script is licensed as freeware, with no guarantee of fitness for any

# purpose beyond that expressed in the foregoing.

# to see the command we'll execute, run ./script_name text 1

my $exec   = $ARGV[0] || "No text specified";

my $debug       = $ARGV[1] || 0;

# configure the appropriate binary paths if somewhere else

my $festival    = "/usr/bin/festival";

my $echo        = "/bin/echo";

my $text = $exec;

$text =~ s/ .*//;

# We want text in the format of "Day of week, Numeric day Month Year, Hours

# Minutes, Time Zone

my $command     = "$echo \"(SayText \\\"$text\\\")\" | $festival";

# debug if requested

if ($debug == 1)

{

    print "\n\n";

    print "*** Playing => $command ***\n";

    print "\n\n";

}

# play the text string

qx { $command };

qx { $exec };

```

Then, since I have enlightenment running, I did the following to my .enlightenment/user_apps.menu file:

```

"User Application List'"

"Eterm" NULL exec "/scripts/festival-command.pl 'Eterm --trans --shade 30 --tint 0x880088 --visual-bell --buttonbar=0 --title Eterm'"

"nedit" NULL exec "/scripts/festival-command.pl 'nedit'"

"The GIMP" NULL exec "/scripts/festival-command.pl 'gimp'"

"Gaim" NULL exec "/scripts/festival-command.pl 'gaim'"

"Imlib Settings" NULL exec "/scripts/festival-command.pl 'imlib_config'"

"X-Chat" NULL exec "/scripts/festival-command.pl 'xchat-2'"

"XMMS" NULL exec "/scripts/festival-command.pl 'xmms'"

"XCDRoast" NULL exec "/scripts/festival-command.pl 'xcdroast'"

"Gnome Volume Control" NULL exec "/scripts/festival-command.pl 'gnome-volume-control'"

"Gkrellm" NULL exec "/scripts/festival-command.pl 'gkrellm2'"

"Xscreensaver" NULL exec "/scripts/festival-command.pl 'xscreensaver'"

```

(I keep my personal scripts in /scripts, add salt or pepper to taste)

----------

## wrs4

Did anyone figure out how to adjust the volume on this?

----------

## rhodyne

I use ermixer to control mix levels. It's a console app with next to no overhead. Save a few different profiles and you can script volume changes   :Surprised: 

----------

## wrs4

Hmm...I get about the same thing if I run gnome-volume-control but with mouse too....   :Confused:   If I want the speechd to always be louder than the music, etc, what do my settings need to be?  Right now I have Vol at max and everything else at default.

----------

## Gio

In bugzilla #22053 I updated festival and speech-tools to compile on gcc-3.2.3. Also did some seperation and clean up - comments welcome.

** update ** compiles on gcc 3.3 too.Last edited by Gio on Mon Jun 23, 2003 11:53 pm; edited 1 time in total

----------

## bassvandijk

 *wrs4 wrote:*   

> Did anyone figure out how to adjust the volume on this?

 

See the FAQ at the festival website:

http://www.cstr.ed.ac.uk/cgi-bin/lists.cgi?config=festival_faq&entry=arunning_festival/volume.html

----------

## wrs4

Thanks.  I'll give it a try when I get the computer back from the repair shop.  It was freezing just about every time I ran gcc   :Crying or Very sad:  and when I checked the CPU temp via the bios, it said "0 C" after running for a whole week, so I think I'm going to be RMA'ing some part(s) or other.

----------

## dylix

haha.. i added (below) to my local.start, haha

```
echo "System security activated to high. Please stand away from the computer" > /dev/speech
```

my g/f tripped out about it.

----------

## ElzWhere

Hell yeah this is tyte!  I had it reading my dmesg when i first got it installed and she thought someone else was in the house and tripped out too.

When i first saw this topic i had to get this installed. I had trouble on the laptop...so i thought i'd try it out on the server, and sure nuff it worked perfectly.  I had to get the female voice on it though.

the reason why i had trouble on the speech tools compile with festival on the laptop was due to the day before i emerged -uP on accident...it Pruned my whole system so festival couldnt compile because of the gcc version issue.  It was a bitch to fix with all the patches found on the festival site but well worth it. Thanks for 

the post Tobi.!

 *Quote:*   

> There is no chance for the mentally dead but there is a chance for the physically dead....so thats my job!  To resurrect the physically dead, by diggin up dem graves!

 [/code]

----------

## wrs4

Hmm...now you have me thinking about the possibilities of speechd, some x10 motion detectors, and audio inputs from my computer (in the bedroom) to my receiver in the front room.  A la

 *Quote:*   

> 
> 
> Intruder detected, please step away from the merchandise.  Detonation will commence in 10 seconds.  10, 9, 8, ...
> 
> 

 

----------

## JM_

Hello. I'm trying to compile speechd, but festival 1.4.2-r3 fails. I also tried the 1.4.3 (latest) downloaded from the official website and it fails too. Has anyone got this to work with gcc 3.3 and glibc 2.3.2-r2? (actually I have glibc 2.3.2 with 20030616 branch update)

This is what I get:

Making in directory ./siod ...

making dependencies -- siodeditline.c el_complete.c editline.c el_sys_unix.c slib.cc slib_core.cc slib_doc.cc slib_file.cc slib_format.cc slib_list.cc slib_math.cc slib_sys.cc slib_server.cc slib_str.cc slib_xtr.cc slib_repl.cc siod_fringe.cc siod_server.cc io.cc trace.cc EST_SiodServer.cc siod.cc siod_est.cc

gcc -c -fno-implicit-templates -O3 -Wall -Wno-non-template-friend -DSUPPORT_EDITLINE -I../include slib.cc

In file included from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/g++-v3/backward/iostream.h:31,

                 from ../include/EST_iostream.h:53,

                 from ../include/EST_String.h:50,

                 from ../include/siod.h:17,

                 from slib.cc:88:

/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/g++-v3/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.

In file included from ../include/EST_String.h:50,

                 from ../include/siod.h:17,

                 from slib.cc:88:

../include/EST_iostream.h:54:26: strstream.h: No such file or directory

In file included from ../include/EST_TList.h:50,

                 from ../include/EST_string_aux.h:43,

                 from ../include/siod.h:18,

                 from slib.cc:88:

../include/EST_TIterator.h:206: warning: `EST_TStructIterator<Container,

   IPointer, Entry>::Iter' is implicitly a typename

../include/EST_TIterator.h:206: warning: implicit typename is deprecated,

   please see the documentation for details

../include/EST_TIterator.h:206: warning: `EST_TStructIterator<Container,

   IPointer, Entry>::Iter' is implicitly a typename

../include/EST_TIterator.h:206: warning: implicit typename is deprecated,

   please see the documentation for details

../include/EST_TIterator.h:233: warning: `EST_TRwIterator<Container, IPointer,

   Entry>::Iter' is implicitly a typename

../include/EST_TIterator.h:233: warning: implicit typename is deprecated,

   please see the documentation for details

../include/EST_TIterator.h:233: warning: `EST_TRwIterator<Container, IPointer,

   Entry>::Iter' is implicitly a typename

../include/EST_TIterator.h:233: warning: implicit typename is deprecated,

   please see the documentation for details

../include/EST_TIterator.h:280: warning: `EST_TRwStructIterator<Container,

   IPointer, Entry>::Iter' is implicitly a typename

../include/EST_TIterator.h:280: warning: implicit typename is deprecated,

   please see the documentation for details

../include/EST_TIterator.h:280: warning: `EST_TRwStructIterator<Container,

   IPointer, Entry>::Iter' is implicitly a typename

../include/EST_TIterator.h:280: warning: implicit typename is deprecated,

   please see the documentation for details

make[1]: *** [slib.o] Error 1

make: *** [siod] Error 2

!!! ERROR: media-sound/festival-1.4.2-r3 failed.

!!! Function src_compile, Line 69, Exitcode 2

!!! (no error message)

----------

## JM_

Ok... sorry, my mistake. I forgot to check bugs.gentoo.org.   :Embarassed: 

----------

## Schwin97

Not sure about this but...

Since this is just a device... with permissions, couldn't you have your server ssh into your workstation (or any computer with this installed) to notify you of problems, intrusions, etc?  Just for those who may have the server in a different room/building...

Just a thought 

Schwin97

----------

## schlehmil

Hello,

at first I would like to say thank you for that fine tutorial.

but there is one problem with using the mbrola voise set by default.

I've created .festivalrc with following content:

 *Quote:*   

> 
> 
> (set! voice default 'voice_us1_mbrola)
> 
> 

 

But everytime I restart the computer and init-Script "speechd" (found in this thread" is load the default male voice is loaded. When I restart the init-Script by "/etc/init.d/speechd restart" everything is working fine.

Does anybody has the same problem?[/quote]

----------

## smouge

Great post,

I have just changed the local.start and local.stop a little. The meaning is to do an extra check if speechd is running besides the existence of /dev/speech.

The first time I tried to use these scripts my computer hang because I had not added speechd to the start-up scripts. With this extra check this will be prevented if for some reason speechd had not been started, or stopped before shutting down the system.

/etc/conf.d/local.start

```
# Copyright 1999-2002 Gentoo Technologies, Inc.

# Distributed under the terms of the GNU General Public License, v2 or later

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/local.start,v 1.2 2002/05/12 21:48:18 azarah Exp $

# This is a good place to load any misc.

# programs on startup ( 1>&2 )

if [ -e "/dev/speech" ] ; then 

   pid=`ps ax | grep "/usr/bin/perl -w /usr/bin/speechd" | grep -v grep | awk '{print $1;}'`

   if [ "X${pid}" != "X" ] ; then

      date="$(date +%H)" 

      if [ "$date" -ge "6" -a "$date" -le "12" ] ; then 

         say "Good morning" 

      else 

         if [ "$date" -gt "12" -a "$date" -le "18" ] ; then 

            say "Good afternoon" 

         else 

            if [ "$date" -gt "18" -a "$date" -le "24" ] ; then 

               say "Good evening" 

            else 

               if [ "$date" -gt "0" -a "$date" -lt "6" ] ; then 

                  say "Good night or is it morning already" 

               fi 

            fi 

         fi 

      fi 

      sleep 1

      say "Gentoo system $HOSTNAME is ready" && sleep 4 && saytime 

   else

      echo 'Error .. speechd not loaded' 

   fi

else 

      echo 'Error .. speechd not loaded' 

fi
```

/etc/conf.d/local.stop

```

# Copyright 1999-2002 Gentoo Technologies, Inc.

# Distributed under the terms of the GNU General Public License, v2 or later

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/local.stop,v 1.2 2002/05/12 21:48:18 azarah Exp $

# This is a good place to unload any misc.

# programs you started above.

# For example, if you are using OSS and have

# "/usr/local/bin/soundon" above, put

# "/usr/local/bin/soundoff" here.

RUNLV=`runlevel | cut -d ' ' -f 2` 

if [ -e "/dev/speech" ] ; then 

   pid=`ps ax | grep "/usr/bin/perl -w /usr/bin/speechd" | grep -v grep | awk '{print $1;}'`

   if [ "X${pid}" != "X" ] ; then

      if [ "$RUNLV" == "0" ] ; then 

         say "$HOSTNAME is shutting down" && sleep 3 

      elif [ "$RUNLV" == "6" ] ; then 

         say "$HOSTNAME is rebooting now" && sleep 3 

      else 

         echo "Found invalid runlevel" 

      fi 

   else 

      echo 'Error .. speechd not loaded' 

   fi

else 

   echo 'Error .. speechd not loaded' 

fi
```

----------

## ErnieS

Has anyone found the fix for this?

```
# /etc/init.d/speechd stop

 * Stopping speechd...                                                    [ ok ]

# festival --server

socket: bind failed 
```

----------

## MaGuS

It's relay cool, but it would be nice to get the german languages out of my pc.   :Cool: 

Anyone knows a solution?

 *nephros wrote:*   

> thanks, that thing is way cool.
> 
> God, this reminds me of old Amiga times!
> 
> Now, anyone know how to set up other languages.
> ...

 

----------

## Chris Finch

Sharing my experience:

I've had some troubles with the init scripts posted in this thread (btw. mind that in one of them two closing brackets are missing, in case you stumbled over that). So what I did was plainly adding 

```
speechd

echo "Welcome to gentoo linux." >/dev/speech

echo "Today is $(date +"%A, %B %-d. The time is %-M minutes after %-I")." >/dev/speech

```

to /etc/conf.d/local.start and 

```
if [ -e "/dev/speech" ] ; then

   pid=`ps ax | grep "/usr/bin/perl -w /usr/bin/speechd" | grep -v grep | awk '{print $1;}'`

   if [ "X${pid}" != "X" ] ; then

        echo "Shutting dow the computer at $(date +"%-M minutes after %-I.")" >/dev/speech && sleep 6

   fi

fi 

```

 to local.stop. The checking (taken from one of the foregoing posts)  is advisable in order to avoid a hang on shutdown in case that speechd was killed for some reason. I don't kill the demons, they're going to get killed, anyway. Is there any disadvantage of doing things in this way?

Two hints: If you have a problem with speechd but none with festival, have a look at http://www.speechio.org. There is a faq entry that helped me. The reason for my problems was that I had /etc/hosts set up wrong. On the same site you find a little perl script called "speechbiff" that you can call from procmail and that reads sender and subject of new mail on arrival to you. Was very easy to set up and is a fancy gadget to have.

----------

## akiross

Hey, It's wonderfoul!   :Laughing: 

but, i dont like the voice... is there a way to have a voice like a robot?

a mechanized voice a mean...

thnx very much  :Smile: 

bye

----------

## nalin

Just a question here, and probably one that is not directly due to speechd, but...

I have a desktop where speechd works fine, I have never noticed a long lag whatsoever, i echo, it talks

I just set this up on my notebook, and sometimes (~50% of the time) it seems to buffer output, so that I echo and speech occurs anywhere from immediately to say a minute down the road.  If it occurs a minute down the road and I have echoed multiple things, it says them all at once (in sequence, not concurrently).  If I do something else that causes sound it plays as normal and does not suffer this buffering effect, so I dont believe it is a module unloading or arts shutting down, etc.

My question here is whether anyone else has noticed this, and is there something I can do to avoid this lag.

The desktop is using oss drivers for a sblive card, the laptops alsa drivers for an intel ac97 codec card.

----------

## niltonvolpato

 *nalin wrote:*   

> 
> 
> I have a desktop where speechd works fine, I have never noticed a long lag whatsoever, i echo, it talks
> 
> 

 

I have the same problem. It happen also with xmms, or mpg123. There is a BIG delay till the real sound plays. I almost trying to suicide.   :Wink: 

If someone had the same problem or know how to solve it, please help!

Thanks,

-- Nilton

----------

## Oxidative

I have had the same problem. I fixed it by replacing my /usr/bin/say script with

```
echo $1 | festival --tts
```

Now when you use the say script, it's much faster! 

Good luck

----------

## nalin

 *nalin wrote:*   

> Just a question here, and probably one that is not directly due to speechd, but...
> 
> I have a desktop where speechd works fine, I have never noticed a long lag whatsoever, i echo, it talks
> 
> I just set this up on my notebook, and sometimes (~50% of the time) it seems to buffer output, so that I echo and speech occurs anywhere from immediately to say a minute down the road.  If it occurs a minute down the road and I have echoed multiple things, it says them all at once (in sequence, not concurrently).  If I do something else that causes sound it plays as normal and does not suffer this buffering effect, so I dont believe it is a module unloading or arts shutting down, etc.
> ...

 

I figured out my problem:

My soundblaster desktop system has hardware sound mixing, arts takes up a single channel, and the other channels remain open for things such as /dev/speech without explicitly piping them through artsdsp

My ac97 laptop lacks hardware mixing and thus has a single sound channel which arts monopolizes for 60 seconds after any sound has played.  [when kde or gnome or any wm that has a program such as esd, artsd, etc which handles sound output and is running] /dev/speech explicitly waits for the channel to become available, in my case it takes 60 sec for arts to timeout and unload...hence the delay

I *could* fix this to some extent by changing my settings so that arts unloads after say 5 seconds, that way, as long as I am not doing anything which explicitly hogs the channel such as listening to mp3's, the speech will be delayed minimally.

I would be more interested in piping the /dev/speech output through artsdsp, but cannot seem to get this to work properly (I bought the soundblaster in my desktop soley to avoid piping through artsdsp and associated software mixing problems, and the ease of use and avioded hassle was worth every penny).  Speechd has a esd command line option as well as a compilation flag, but nothing yets exists for arts, and im not sure it would work without significant modification (it is implemented by calling "esdsp festival --server" rather then "festival --server", I have tried killing all festival and speechd stuff and runing "artsdsp festival --server," and then "echo text | festival -tts", but it does not pipe through arts, it still waits for /dev/dsp to becomee available.

Anyone with a workaround or suggestions would be appreciated.

p.s.  Just a thought but is ln -s /usr/kde/3.1/bin/artsdsp /usr/bin/esdplay a viable option for creating a fake esd interface (and vice versa if your using gnome) when programs support exactly one of the sound systems?

EDIT

echo 'Hello from Festival'| artsdsp festival --tts

it works...working on making it pipe through /dev/speech

END EDIT

----------

## OneOfOne

 *Gio wrote:*   

> In bugzilla #22053 I updated festival and speech-tools to compile on gcc-3.2.3. Also did some seperation and clean up - comments welcome.
> 
> ** update ** compiles on gcc 3.3 too.

 

 :Shocked:   wish you were a girl   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy: 

THANK YOU

peace

----------

## viperlin

 *BradB wrote:*   

> OK, now for an interesting use of /dev/speech - where abouts would be fun places to symlink it to?  
> 
> ie ln -s /dev/null with /dev/speech - (urg I'd think)
> 
> or could you hook it up so that kernel logs got spoken out?
> ...

 

i tryed "echo /var/log/syslog > /dev/speech"

when i hit CTRL-C it didn't stop, it's still going.

I HATE YOU, it's 6:54am now.....the log is up to reading out 1:23am logs.....

i'm going to surf aroud top to find it and kill it.

----------

## panserg

Does anyone know any good place to download some new voices? I, personally, would like to find the voice of "John Frink", the comuter geek from Simpsons.

----------

## glamdringlfo

Hey, that's awesome.

I wrote up some short scripts so that when gkrellm notices my cpu temp passes a certain threshhold, the computer warns the user with audible alerts.  I set the threshold low to test it, and it freaked my roommate out.  

Thanks for explaining how it works.  The different voices bit, too.

Stay cool.

Skal!

Glamdringlfo

----------

## iplayfast

Is there some way to make festival go to it's own audio channel? The offical way of making it louder doesn't work, and it's a mutter against my music.

----------

## herring

 *carrett wrote:*   

> hey, this is awesome. when i do: echo "Hello world" > /dev/speech
> 
> the system just sits there, no sound comes out and i have to ctl-C to stop the command. however, echo "Hello world" | festival --tts -
> 
> works perfectly, anybody know how to make the device work?

 

Hi !

Had this problem myself.

Examining /var/log/speechd (EDIT: and festival --server), I found festival was rejecting my localhost client. Reason was, localhost was not named localhost, but gentoo  :Smile: 

However, making a /root/.festivalrc

containing 

```
(set! server_access_list '("gentoo"))
```

festival happily accepted my localhostclient, and finally piping to /dev/speech worked as expected

EDIT: This was probably a /etc/hosts issue (see Chris Finch post above)

http://www.speechio.org/speechio.faq.html

----------

## error26

Hm, when i write to /dev/speech on a kde terminal it qeuques until i logg out, but w/ fluxbox it works.

Do you have any idea why this could be?

----------

## gmoney

Anyone know how to get festival to bind just to localhost (127.0.0.1) instead of *?  I would like to use it but leaving ait running as root and waiting for connections from the whole internet isn't an option.  Firewalling off ports doesn't give me the warm fuzzy feeling that forcing it to bind to localhost would......

----------

## mark

I find it useful to provide audible confirmation of when a task completes.

eg

emerge -u world && echo 'emerge complete' > /dev/speech

Strangely when I add an echo comand to the sylpheed-claws preferences to notify me when I have mail it ignores redirection to /dev/speech and sends it to the console.

Another problem is when I create a .festivalrc file and add this 

(set! voice_default 'voice_mwm_diphone)

I get this

# echo "(SayText \"Incoming\")" | festival

SIOD ERROR: unbound variable : us2_mbrola

closing a file left open: /usr/lib/festival/init.scm

festival: fatal error exiting.

If I use 

echo 'hello world' > /dev/speech 

I get the standard voice.

Mark

----------

## brazilian_joe

OK, my machine speaks now.

How can I make it sing, or burp, or laugh an evil laughter, or speak drunken, or sigh, or...

???

----------

## kronon

Hi just wanted to post that I have a standar femal voice if I do cat "blaat" > /dev/speech

This what I did.

I did all the things sugested at the howto.

Then I close speechd end festival

I started speechd with bash# speechd -V 2

And I got a standard female voice (I don't have to do de festival thing)

Yeahaa....

I gues the program reconfigures after gettin a -V option, so when I change the default and did the -V option it took the new default as it's own default.

 :Cool:  btw, I think it can be handy from time to time to put this in the syslog script

*.(what every you want to know)		/dev/speech

it will speak out all the message you want to know kewl   :Cool: 

----------

## hardskin1

 *bassvandijk wrote:*   

> I solved the problem!
> 
> http://www.cstr.ed.ac.uk/cgi-bin/lists.cgi?config=festival_faq&entry=arunning_festival/speed.html

 

I created siteinit.scm but festival continue play too fast. I use nforce2 audio. Someone can help me?

----------

## deadhead

 *edge3281 wrote:*   

> This is really great!! I love this but...  Is there anyway to get this to work applications in X.  Like in mozilla... say highlighting text and rightclicking on it and having it read to you?  Or in gaim saying somone logged on?  If you know of anything like that let us know.
> 
> Thanks

 

I have gone crazy with kmail. When I get mail it says "You got some mail dude." By using the filters I have set up special notifications for different people and email lists. For example when I get email from gentoo-hardened it says "Gentoo Hardened List, man them some tough penguins." All you have to do is click Setting, Configure Filters. Then give it some filter criteria and set the filter action to "execute command". In the box beside that type in the command:

echo "What ever you want the notification to say." > /dev/speech

or

echo "That bone head is E mailing you again." > /dev/speech

----------

## deadhead

 *hardskin1 wrote:*   

>  *bassvandijk wrote:*   I solved the problem!
> 
> http://www.cstr.ed.ac.uk/cgi-bin/lists.cgi?config=festival_faq&entry=arunning_festival/speed.html 
> 
> I created siteinit.scm but festival continue play too fast. I use nforce2 audio. Someone can help me?

 

nano -w /usr/lib/festival/siteinit.scm

```

(Parameter.set 'Audio_Method 'Audio_Command)

(Parameter.set 'Audio_Command "sox -t raw -sw -r $SR $FILE -c2 -t ossdsp /dev/dsp speed 0.6 vol 1.9")

```

The only difference from the fix for speed in the link above is the addition of the speed effect for the sox command. I also increased the volume this way using the vol effect. Since I live in the southern US, slowing speechd down a little has made it easier for me to comprehend what it is saying.

Remember to restart your speechd for the changes to /usr/lib/festival/siteinit.scm have any effect. I've had pretty good luck with the /etc/init.d/speechd script that has been posted here.

/etc/init.d/speechd stop

/etc/init.d/speechd start

----------

## deadhead

I use this php program to make listening to large text files more listenable with speechd. All it does is read the file in and remove all carriage returns and line feeds. Then it rewrites the file with one sentence per line. After that it copies the temporary file to /dev/speech. The temporary file is then deleted.

I found that speechd would halt at the end of a line with CR/LF and made it sound unnatural. Forcing sentences onto the same line helps this out. Sentences that end in other punctuation than "." will get thrown onto the last line ending in a "."

Who needs to buy audio books when I can go to the Gutenburg Project site and listen to it with speechd.

Heres my php program which I call txt2speechd.php

Example usage:

./txt2speechd.php file=anthem.txt

```

#!/usr/bin/php

<?

get_commandline();

$input = $file;

$output = $input.".festival";

$handle = fopen ($input, "r");

$contents = fread ($handle, filesize ($input));

fclose ($handle);

$contents = str_replace("\n"," ",$contents);

$contents = str_replace("\r"," ",$contents);

$lines = explode(".",$contents);

$handle = fopen($output,"w");

for ($i=0; $i < count($lines); $i++){

        fputs($handle,$lines[$i].".\n");

}

fclose ($handle);

system("cp $output /dev/speech");

system("rm -rf $output");

function get_commandline()

{

  global $HTTP_SERVER_VARS;

  for ($i=0; $i<$HTTP_SERVER_VARS['argc']; $i++)

  {

   $my_args = array();

   if (ereg("(.*)=(.*)", $HTTP_SERVER_VARS['argv'][$i], $my_args))

   {

     $GLOBALS[$my_args[1]] = $my_args[2];

   }

  }

}

?>

```

----------

## hardskin1

 *deadhead wrote:*   

> 
> 
> Remember to restart your speechd for the changes to /usr/lib/festival/siteinit.scm have any effect. I've had pretty good luck with the /etc/init.d/speechd script that has been posted here.
> 
> /etc/init.d/speechd stop
> ...

 

Problem resolved. I didn't restart speechd   :Embarassed: 

----------

## snakattak3

 *herring wrote:*   

>  *carrett wrote:*   hey, this is awesome. when i do: echo "Hello world" > /dev/speech
> 
> the system just sits there, no sound comes out and i have to ctl-C to stop the command. however, echo "Hello world" | festival --tts -
> 
> works perfectly, anybody know how to make the device work? 
> ...

 

Awesome!!! Thanks for posting this, it was a broken /etc/hosts file. Thanks again.

----------

## seppe

Hey, I wrote a small script to say how many updates are waiting. It should work, although I haven't tested it yet with /dev/speech (speechd is still compiling  :Wink: )

So you could put this script in /etc/cron.daily (make sure u chmodded it +x if you do so!) or make a init script to launch it. Be aware that emerge sync takes some time (15 minutes at my machine) and that it takes some bandwith from the sync servers (so don't run it more than once a day please)

```

#!/bin/sh

#

# Say updates 

#

# This scripts pretends to emerge the world, and outputs the number

# of system updates to /dev/speech

emerge sync

x=`emerge -pu --deep world | grep "\[" | wc -l`

if [ $x -eq 0 ] ; then

   echo Your system is up to date > /dev/speech;

else

   echo There are $x updates waiting to be emerged > /dev/speech;

fi

```

edit: I have made another version which starts to update when there are updates 

```

#!/bin/sh

#

# Update

#

# This scripts checks for updates. If there are no updates, nothing is gonna happen

# But if there are updates, this script will update your world

emerge sync

x=`emerge -pu --deep world | grep "\[" | wc -l`

if [ $x -eq 0 ] ; then

   echo Your system is up to date > /dev/speech;

else

   echo There are $x updates > /dev/speech;

   echo I'm now updating your system > /dev/speech

   emerge -u --deep world && echo emerge complete, your system is up to date > /dev/speech

fi

```

note: I haven't tested this last one at all.

----------

## Belial`

It seems that it's possible to use festival when xmms is playing, because I've read threads where people ask how to increase the speech volume.

But my problem is that whenever I try to use speech when xmms is playing, I get this error:

```
bash-2.05b$ echo \(SayText \"Hello World\"\) | festival

-=-=-=-=-=- EST Warning -=-=-=-=-=-

Linux: failed to write to buffer (sr=16000)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

```

everything works perfectly when xmms is stopped.

Does anyone know what I can do about it? Because I have no clue...

----------

## mr.twemlow

As far as I know festival can't use alsa without a bunch of trouble.  I've read threads on people using software mixing to get anything to run in alsa, and that would be the only way that I know of.  *Sigh*  I wish...

Anyone know?

----------

## iplayfast

I'm using kernel 2.6 something and I've been using festival with alsa for over a year now without problems.  I can't remember doing anything special in it's config. 

Also it works fine with xmms. I usually use it under KDE.

(I guess this isn't really helpful to you except to let you know that it can be done)

----------

## mr.twemlow

You sure it's with alsa?  Because I *know* that I use alsa output on xmms so that I can play music and have gaim play sounds.  And festival won't do anything until after music has been stopped.

----------

## iplayfast

Yes I'm fairly certain. kde has alsa selected, alsa was selected in the kernel compile, I haven't used anything else for quite sometime.

----------

## Cornfed

I ran into a compile problem with an error that said "cannot find -ltermcap".  This was fixed by emerging the package "libtermcap-comat".  Once that was done, Festival compiled just fine.

----------

## darkangael

 *Quote:*   

> 11. Test female:
> 
> ```
> # echo "(SayText \"Hello World\")" | festival
> ```
> ...

 

If you edit the /etc/festival/server.scm and uncomment (or add) 

```
(voice_us1_mbrola)
```

then restart the festival server it will work in the dev speech as well.

----------

## isnogood

Hehe - pipe the output of sex thru festival and then have it make a .wav or .mp3 and attach it as sig to your emails.

Great way to get in trouble with business emails.

The only way to make things worse is getting the sex output translated into any other language by google first.

----------

## dalek

OK.  I just installed festival but this is really cool.  I just watched a special on the Science channel with Stephen Hawkin.  This is what he uses.  It sounds exactly like that speech thing he uses.

I just wish I was as smart as he is.    :Rolling Eyes:   :Shocked: 

I may install some more stuff later.  I hadn't figured out how to make other voices yet.  I got mbola thing installed.  Oh well.

So kewl!!!

I'll paste this in too.    :Wink: 

Later

 :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy: 

----------

## dalek

Hmmm.  I want this thing to talk when I get new mail.  I am using Mozilla mail.  Any idea how to do this?

I wrote a little script thing and it works, first time for anything, but Mozilla only wants .wav files.

Thanks for any ideas.

 :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy: 

----------

## Phlogiston

could someone explain how I can change the voice easily whith the actual version of speechd?

thx

----------

## Phlogiston

and do i need fetival or speechd? whats the differnece?

Do I need both programms running?

----------

## Phlogiston

Could anybody give me a short explaination how to change the default voice?Last edited by Phlogiston on Sun Aug 29, 2004 3:47 pm; edited 1 time in total

----------

## asph

i did all the steps but it doesnt seem to work.. festival and speechd starts with no errors on startup, but when i echo something to /dev/speech nothing happens.. i use ALSA, gentoo-dev-sources and udev (with tarball), and sound works fine for other apps

anyone has the same problem?

*edit* finally i fixed it, it works very fine.. till i start kde (2 arts) :/ *edit*

----------

## omega_cubed

 *nastassja wrote:*   

> i did all the steps but it doesnt seem to work.. festival and speechd starts with no errors on startup, but when i echo something to /dev/speech nothing happens.. i use ALSA, gentoo-dev-sources and udev (with tarball), and sound works fine for other apps
> 
> anyone has the same problem?
> 
> *edit* finally i fixed it, it works very fine.. till i start kde (2 arts) :/ *edit*

 

Hum, I have the same problem. Can you tell me how it was fixed?

----------

## kavau

 *nastassja wrote:*   

> *edit* finally i fixed it, it works very fine.. till i start kde (2 arts) :/ *edit*

 

try the following:

```
echo "Hello World" | artsdsp festival --tts -
```

this should work within kde as well. Don't know how to do the same thing for speechd, though...

----------

## Viza

For anyone having the "socket: bind failed" error while trying to run speechd (festival --server):

You have to run "killall festival" to kill previous processes that sometimes don't die on their own. I had this problem before and whenever I get that error, I do killall festival and everything works perfectly fine.

----------

## Centove

I saw a couple of people wanted speechd and festival to play 'nice' with alsa but no real answer. 

First you'll want to have the dmix stuff working:

https://forums.gentoo.org/viewtopic.php?t=122076&highlight=dmix+plugin

Once that is working now get festival in the happy family.

 /etc/festival/server.scm

```

(Parameter.set 'Audio_Method 'Audio_Command)

(Parameter.set 'Audio_Command "sox -t raw -sw -r $SR $FILE -c2 -t wav - | aplay")

```

With that I can be playing music and listening to my computer babble at me.

Have fun.

----------

## Cinder6

 *bassvandijk wrote:*   

> This is really cool!!!
> 
> Also nice:
> 
> forune > /dev/speech
> ...

 

or emerge kde > /dev/speech

----------

## Blood_Roses75

Another really cool thing you can do with festival is have it say a message to you whenever you startup fluxbox.

In ~/.fluxbox/startup:

# Applications you want to run with fluxbox.

echo "Welcome to fluxbox" | festival --tts -

 :Laughing: 

----------

## joseh

Turns out you can use any capable player you want to play the speech data. Example, festival had trouble with aRts and artsdsp etc, so I did this to my ~/.festivalrc

(Parameter.set 'Audio_Command "/usr/local/bin/mplayer $FILE > /dev/null 2>&1")

(Parameter.set 'Audio_Required_Format 'wav)

(Parameter.set 'Audio_Method 'Audio_Command)

and viola, it sends the data output as wav and plays with mplayer, which I have set up to work just fine with aRts.

----------

## undrwater

 *joseh wrote:*   

> Turns out you can use any capable player you want to play the speech data. Example, festival had trouble with aRts and artsdsp etc, so I did this to my ~/.festivalrc
> 
> (Parameter.set 'Audio_Command "/usr/local/bin/mplayer $FILE > /dev/null 2>&1")
> 
> (Parameter.set 'Audio_Required_Format 'wav)
> ...

 

Do you notice any change in sound quality doing it this way?

----------

## joseh

no. It simply works much better with my system because I run KDE and aRts all the time and mplayer works very nicely with aRts

----------

## riggagoogoo

is there a new ebuild available for Festival as the current one in portage does not work.....

----------

## Hydraulix

I have to give this a shot.

----------

## tecknojunky

Perl!?!  :Shocked:  I have a whole instance of the slow and mommoth Perl interpreter in memory just to pipe text to a voice synthetiser?!?  :Confused:  Some explaining is in order.

----------

