Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Documentation, Tips & Tricks
  • Search

[SOUND] speechd lets your Computer speak

Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Post Reply
Advanced search
136 posts
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • Next
Author
Message
Tobi 2.4.20
n00b
n00b
Posts: 11
Joined: Thu Mar 27, 2003 8:30 am
Location: Düsseldorf, Germany, Earth
Contact:
Contact Tobi 2.4.20
Website

[SOUND] speechd lets your Computer speak

  • Quote

Post by Tobi 2.4.20 » Sat Mar 29, 2003 5:31 pm

Hi!
This is how I set up speechd:

1. Become root

Code: Select all

# su -
2. emerge needed Packages

Code: Select all

# emerge speechd
3. Init-Script:

Code: Select all

# vi /etc/init.d/speechd
and fill with:

Code: Select all

#!/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

Code: Select all

# chmod 755 /etc/init.d/speechd
5. if you want to come up speechd at boottime type:

Code: Select all

# rc-update add speechd default
6. start speechd

Code: Select all

# /etc/init.d/speechd start
7. Test:

Code: Select all

# 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

Code: Select all

# emerge mbrola
9. edit the voices scheme

Code: Select all

# vi /usr/lib/festival/voices.scm
10. search for "us1_mbrola" and put it in top of the list and save the file.
Before:

Code: Select all

'(kal_diphone
    ked_diphone
    don_diphone
    rab_diphone
    en1_mbrola
    us1_mbrola
    us2_mbrola
    us3_mbrola
    gsw_diphone  ;; not publically distributed
    el_diphone)
After:

Code: Select all

'(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:

Code: Select all

# 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
Last edited by Tobi 2.4.20 on Fri Apr 04, 2003 10:51 am, edited 3 times in total.
Scientists tell us that the fastest animal on earth, with a top speed of 120 feet/second, is a cow that has been dropped out of a helicopter.
-Dave Barry
Top
bsolar
Bodhisattva
Bodhisattva
User avatar
Posts: 2764
Joined: Sun Jan 12, 2003 5:14 pm

  • Quote

Post by bsolar » Sat Mar 29, 2003 5:47 pm

You might want to commit that to bugzilla. :wink:
I may not agree with what you say, but I'll defend to the death your right to say it.
Top
Ivion
n00b
n00b
User avatar
Posts: 45
Joined: Thu Jan 23, 2003 10:18 pm
Location: Amsterdam

  • Quote

Post by Ivion » Sat Mar 29, 2003 8:53 pm

Is there also a way to let the 'voice' sound different? Like changing it to a woman's voice? :)
Top
barlad
l33t
l33t
User avatar
Posts: 673
Joined: Sat Feb 22, 2003 10:55 pm

  • Quote

Post by barlad » Sat Mar 29, 2003 10:35 pm

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

I think you can change the voice in Festival btw
Top
Tobi 2.4.20
n00b
n00b
Posts: 11
Joined: Thu Mar 27, 2003 8:30 am
Location: Düsseldorf, Germany, Earth
Contact:
Contact Tobi 2.4.20
Website

  • Quote

Post by Tobi 2.4.20 » Sun Mar 30, 2003 11:32 am

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.
Scientists tell us that the fastest animal on earth, with a top speed of 120 feet/second, is a cow that has been dropped out of a helicopter.
-Dave Barry
Top
Ante
n00b
n00b
Posts: 14
Joined: Sat Dec 28, 2002 4:36 pm
Location: 127.0.0.1

  • Quote

Post by Ante » Sun Mar 30, 2003 6:02 pm

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
Why?
Top
Vagabond
Apprentice
Apprentice
Posts: 192
Joined: Sun Jan 19, 2003 2:42 pm

  • Quote

Post by Vagabond » Sun Mar 30, 2003 7:46 pm

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
Top
barlad
l33t
l33t
User avatar
Posts: 673
Joined: Sat Feb 22, 2003 10:55 pm

  • Quote

Post by barlad » Sun Mar 30, 2003 7:53 pm

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

Code: Select all

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 ;)
Top
Vagabond
Apprentice
Apprentice
Posts: 192
Joined: Sun Jan 19, 2003 2:42 pm

  • Quote

Post by Vagabond » Sun Mar 30, 2003 8:18 pm

Yeah, I get the same error, damn.

Vag
Top
link97381
n00b
n00b
Posts: 34
Joined: Sat Mar 29, 2003 10:38 am
Location: Silverton Oregon

  • Quote

Post by link97381 » Mon Mar 31, 2003 1:29 pm

Ya I get a "socket: bind failed" error.....anyone know how to fix it?
Top
Lockup
Guru
Guru
User avatar
Posts: 430
Joined: Thu Jul 25, 2002 3:20 pm

  • Quote

Post by Lockup » Mon Mar 31, 2003 1:34 pm

if only we could use the at&t voices with that...
Top
Tobi 2.4.20
n00b
n00b
Posts: 11
Joined: Thu Mar 27, 2003 8:30 am
Location: Düsseldorf, Germany, Earth
Contact:
Contact Tobi 2.4.20
Website

  • Quote

Post by Tobi 2.4.20 » Mon Mar 31, 2003 6:30 pm

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
Scientists tell us that the fastest animal on earth, with a top speed of 120 feet/second, is a cow that has been dropped out of a helicopter.
-Dave Barry
Top
TheCoop
Veteran
Veteran
User avatar
Posts: 1814
Joined: Sat Jun 15, 2002 5:20 pm
Location: Where you least expect it
Contact:
Contact TheCoop
Website

  • Quote

Post by TheCoop » Mon Mar 31, 2003 8:34 pm

that is absolutly wonderful, thankyou, how about including the rc script in the ebuild?
95% of all computer errors occur between chair and keyboard (TM)

"One World, One web, One program" - Microsoft Promo ad.
"Ein Volk, Ein Reich, Ein Führer" - Adolf Hitler

Change the world - move a rock
Top
Tobi 2.4.20
n00b
n00b
Posts: 11
Joined: Thu Mar 27, 2003 8:30 am
Location: Düsseldorf, Germany, Earth
Contact:
Contact Tobi 2.4.20
Website

  • Quote

Post by Tobi 2.4.20 » Tue Apr 01, 2003 6:07 am

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.
Scientists tell us that the fastest animal on earth, with a top speed of 120 feet/second, is a cow that has been dropped out of a helicopter.
-Dave Barry
Top
bassvandijk
Guru
Guru
User avatar
Posts: 306
Joined: Fri Sep 13, 2002 9:22 pm
Location: Haps, Netherlands

  • Quote

Post by bassvandijk » Wed Apr 02, 2003 6:01 pm

This is really cool!!!

Also nice:

forune > /dev/speech
or
dmesg > /dev/speech
Top
bassvandijk
Guru
Guru
User avatar
Posts: 306
Joined: Fri Sep 13, 2002 9:22 pm
Location: Haps, Netherlands

  • Quote

Post by bassvandijk » Wed Apr 02, 2003 7:08 pm

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...
Top
bassvandijk
Guru
Guru
User avatar
Posts: 306
Joined: Fri Sep 13, 2002 9:22 pm
Location: Haps, Netherlands

  • Quote

Post by bassvandijk » Thu Apr 03, 2003 12:33 pm

I solved the problem!

http://www.cstr.ed.ac.uk/cgi-bin/lists. ... speed.html
Top
bassvandijk
Guru
Guru
User avatar
Posts: 306
Joined: Fri Sep 13, 2002 9:22 pm
Location: Haps, Netherlands

  • Quote

Post by bassvandijk » Thu Apr 03, 2003 6:39 pm

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

Code: Select all

#!/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

Code: Select all

#/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.
Top
pubecon
Guru
Guru
User avatar
Posts: 342
Joined: Mon Mar 03, 2003 1:34 am
Location: Glasgow, Scotland

  • Quote

Post by pubecon » Mon Apr 07, 2003 6:41 pm

so how do you set up the festival server so you don't get the binding error?
Top
papabean
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 130
Joined: Sat Oct 26, 2002 5:28 pm
Location: Sacramento, California
Contact:
Contact papabean
Website

  • Quote

Post by papabean » Mon Apr 07, 2003 11:14 pm

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:

Code: Select all

echo "Hello World" | festival --tts -
or:

Code: Select all

fortune | festival --tts -
Hope this helps anyone else.
Last edited by papabean on Mon Apr 07, 2003 11:25 pm, edited 1 time in total.
-- The world is full of tough guys. It doesn't need me to be one too.
Top
Chewie
n00b
n00b
User avatar
Posts: 26
Joined: Wed Apr 02, 2003 1:10 pm
Location: Sweden, Boras

  • Quote

Post by Chewie » Mon Apr 07, 2003 11:24 pm

Hehe this is really cool, thanks dude. :D
Top
Yinchie
Apprentice
Apprentice
Posts: 179
Joined: Wed Mar 05, 2003 9:39 am
Location: The Netherlands

  • Quote

Post by Yinchie » Tue Apr 08, 2003 12:33 am

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.

....................

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.
Kewl, thanks for this.
Going to try this out! :D
Top
Ian
l33t
l33t
Posts: 834
Joined: Mon Oct 28, 2002 10:15 pm
Location: Somerville, MA

  • Quote

Post by Ian » Tue Apr 08, 2003 1:33 am

bassvandijk wrote:I solved the problem!

http://www.cstr.ed.ac.uk/cgi-bin/lists. ... speed.html
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.

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 :P.

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.
Top
papabean
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 130
Joined: Sat Oct 26, 2002 5:28 pm
Location: Sacramento, California
Contact:
Contact papabean
Website

  • Quote

Post by papabean » Tue Apr 08, 2003 6:31 am

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.
-- The world is full of tough guys. It doesn't need me to be one too.
Top
Gnufsh
Guru
Guru
User avatar
Posts: 400
Joined: Sat Dec 28, 2002 5:40 pm
Location: Portland, OR
Contact:
Contact Gnufsh
Website

  • Quote

Post by Gnufsh » Tue Apr 08, 2003 11:37 am

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

136 posts
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • Next

Return to “Documentation, Tips & Tricks”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy