EnglishEspañol

Q3Speech

By Carlos Palencia, ©2003.

    1. What is Q3Speech?
    2. Downloads.
    3. How to use it.
    4. Text to Speech programs (and installation).
    5. Reporting a bug.
    6. Samples.
    7. Acknowledgements.

1. What is Q3Speech?


    Q3Speech is a small script, written in Perl, which filters out the output from the Quake 3 Arena console so you can redirect it to a text to speech (tts) program. This way you can hear the chat texts from other users through your speakers. It also supports team chats (it works with True Combat and Urban Terror /say_team command) and it works under Windows and Linux.

    You will need a tts program. Note that the quality of the voices strongly depends on the tts you are using, so you may try many of them. Below there are some links.

    Q3Speech is released under the GPL, so it's totally free. This also means that there is no warranty about this script, which is released "as is". So if it melts your computer, kills your dog, or makes you run out of ammo in the worst moment... then will be your fault :P.

2. Downloads.

    You can download Q3Speech in english or spanish here: http://sourceforge.net/project/showfiles.php?group_id=93330

3. How to use it.

    First, edit the script. It is fully commented so you won't have any problems. The important things there are:

$logfile:

    It must content the log file Quake III uses. If you use a mod, it should point to its directory. For example, if you are using True Combat under Windows, it should be: $logfile='C:\Program Files\Quake III Arena\truecombat\qconsole.log';

    If you are using vanilla Quake under Linux, then it should be: $logfile='/home/user/.q3a/baseq3/qconsole.log';

$speechcmd:

    It must content the tts command. After processing the console output, Q3Speech will have a line of text to read. Then it will run $speechcmd.

    If the path to your tts program has white spaces you will need to double quote it. For example, let's suppose you are using ReadPlease under Windows, $speechcmd should be: $speechcmd='"C:\Program Files\ReadPlease 2003\ReadPleasePlus2003.exe" /text="LINE"';

    Here you can find some programs to use as well as a dummy guide to install them :).

    If you don't want to use a tts program (or you don't have any) then leave this var empty. Q3Speech will filter the text just to the stdout. May be useful if you have a console dump and want to read just the chats.

$backslash:

    Some characters make some errors :). This is usually fixed by adding a backslash before them. Depending on your $speechcmd, your tts will read also this backslashes. If it's your case then set this to 0, so backslashes will be removed.

    In the other hand, sometimes backslashes are needed, so, if you have errors, try to set this to 1 (this is the default). If you still have problems, then please report them.

$readname:

    If you don't want the name of the user to be heard then set this to 0. A line like "Rad: Hi to everybody." will be read as "Hi to everybody.".

$noprints:

    If this is set to 0, Q3Speech will print messages like "Rad didn't enter the game (banned)." or many others. If you just want to see the chat messages, the set it to 1.

@censor:

    @censor is an array of words. If any of the words is found in a line, that line won't be read. If you just want that word not to be read, then use @replacing.

@replacing:

    @replacing is another array of words. You must add pair of words to it, so, if the first word is found in a line, it will be replaced with the second word. The third word will be replaced with the fourth, and so on.

    Note you can use several lines to add words.

@entermsg:

    This is the most important var in the script. Q3Speech only sees the output from the console, so it doesn't know which are the names of the players. It guesses them by matching the messages from Quake 3 with special sentences. The most important (I think) is " entered the game".

    Whenever a player enters the game, the message "NamePlayer entered the game" is displayed. Q3Speech will take care of it and addNamePlayeras a user. The problem here is that if you enter a game on a server, you will have to wait till the next round so the others player enter the game again, and you won't hear anything from them until they are registered as users.

    You can manually add the other players, or add more "enter messages" the game uses. As an example there are a few extracted from True Combat and Urban Terror in the script.

@banned:

    @banned is an array of users. If a user is in this list, he won't be heard (he will be banned ;)). You can ban users while in-game.

    Note: If you don't want to hear your own chat texts, then ban yourself.

@chosen:

    In the other hand, if you just want to hear chat texts from a few (known) people (for example, clan mates), then add their names to this list. If there is at least one user in this list, any text from a user not in the list won't be heard.

$q3speechon:

    By default, Q3Speech will be on. If you want it to be off, then set this to 0. Of course you can activate (and deactivate) it in the game.


    Now the script is ready to use! Be sure the perl location is right (or you have a perl interpreter under Windows) and execute it:

q3speech.pl

    Now, enter Quake III, and be sure to run the command:

/logfile 3

    Play the game as usual. While you are playing, Q3Speech will try to detect new users, and you should hear them through your speakers! Now is time to see what can you do while you are playing.

Commands:

    Open the console and write one of the next commands. Quake3 will complain saying it's an unknown command, but don't worry.

/q3speech on:

    Will activate Q3Speech.

/q3speech off:

    Will deactivate Q3Speech.

/q3s_add user:

    It will add user to the users list, so he will be heard next time he speaks.

/q3s_ban user:

    It will add user to the banned users list, so he won't be heard any time he speaks.

/q3s_unban user:

    It will remove user from the banned users list, so he will be heard next time he speaks.


4. Text to Speech programs (and installation).

    To use Q3Speech you must use a text to speech (tts) program. There are a lot of them. I'll explain just a little how to install one of them.

    Windows users:

    First, you need a perl interpreter. This script has been tested using Active Perl. It's free, and you can download it at http://www.activestate.com.

    Once installed, you'll need a tts program, unless you want Q3Speech just to filter out console dumps. Q3Speech has been tested with ReadPlease, which can be downloaded at http://www.readplease.com. Unfortunately, it is not free, because we need it's command line support, which only works under it's ReadPlease Plus release. Anyway, you have a 30 days free trial, so you may register or not after trying (by the way, it would be a good idea to left the program open before you run Quake, or windows with "please, register" will appear each time someone speaks). Of course, you can download another tts program as well. In fact, we are looking for a free tts program. If you want to help, just look for another and report us a nice (and free) solution. For example, searching "text to speech" under Google reports more than 300,000 results!.

    Well, suppose we installed it under C:\Program Files\ReadPlease 2003\ReadPleasePlus2003.exe. We want to use it through the command line. For example, if you run: ReadPleasePlus2003.exe /text="Hello, world" you will hear Hello, world through your speakers. So, our $speechcmd will be:
$speechcmd='"C:\Program Files\ReadPlease 2003\ReadPleasePlus2003.exe" /text="LINE"';

    Please note that the path to ReadPlease had white spaces, so we had to double quote it. As you can see, we put LINE inside $speechcmd. It will be replaced with the line said in-game.

    Now it's time to edit the file, change it to fit our needs and run Quake III. While you are playing, you must run the "logfile 3" command, which will output the console to a file. Just open the console and write /logfile 3. If you want, you can add /logfile 3 to you q3config.cfg file, so you don't have to make this each time you enter Quake.

    And that's all. Hopefully you will hear the chats through the speakers!

    Linux users:

    You will need perl to run this script and it's included in most (all?) distributions. But you also need a tts program. I will recommend you two (because they are free):Festival and Mbrola. They support many languages. This is important, because reading a german text with a spanish voice will result in a total nonsense :).

    You should install both of them, as the best performance (I've found) is using the Mbrola voices through the tts Festival (note: Festival doesn't need Mbrola, but Mbrola needs a text to diphones program, which can be Festival or another). Once installed (refer to their pages for instructions), you should have two binaries: festival andmbrola.

    Festival has its own voices, but can use many of Mbrola ones. If you speak english you may like the us1 mbrola voice (american female). Try many of them to see what is best for you. A quick program to do tests is tkFestival, which is a festival front end.

    Supposing you are using festival you may change your ~/.festival.rc to make the voice you selected the default. If you don't have this file look in the festival directory, it has an example of it.

    Once you set up your tts program, you should try it to see if it works well. Try something like: "echo This is a test | festival --tts". If it works well you've done the hard part! The $speechcmd var should contain "echo LINE | festival --tts". Note that LINE will be replaced with the chat line to be read.

    If you speak spanish there is a very quick way to get your tts ready. Just install the ircHa program. It is also based on Mbrola, but it has all the needed files in its download. Once you installed it (it's very easy), you should get a script called lee. Try something like: "lee Esto es una prueba". If this works, you made it! The $speechcmd var should contain "echo LINE | lee | mbrola /usr/lib/mbrola/es1/es1 - -.raw | rawplay". Note: You'll need rawplay. It's a very basic audio player. You can look for it on Rpmfind.

    There are many others tts programs. Just give google a try to see if you find something better ;).

Links:

    Festival: http://www.cstr.ed.ac.uk/projects/festival/
    Mbrola: http://tcts.fpms.ac.be/synthesis/mbrola.html
    IrcHa: http://www.zoom.es/~angel/ircha.html
    tkFestival: http://sourceforge.net/projects/tkfestival/

6. Reporting a bug.

    I'm pretty sure there will be bugs. Most of them (I hope) will be easy to fix, so maybe yourself can solve them in your own. If it's not the case, then maybe I can help.

    First, dump the console using the Quake 3 command "/condump file.txt". Edit file.txt and remove the lines which aren't important (try to make it as shorter as possible) and then send it to me (or use the forums) with a description of the problem.

    You can contact me at radpc007@yahoo.es.

7. Samples.

    Before download Q3Speech you should hear some of this samples, so you won't be disappointed when you run the script :). They aren't edited, just converted to mp3. I've tried different voices so you can see the difference.

English:

Sentence: "I have the flag. Please I need some cover!"

    American female: Festival + us1 mbrola voice.
    British male: Festival + en1 mbrola voice.
    American male: Festival (don_diphone voice).
    American male: Festival (kal_diphone voice).

Sentence: "There is a sniper around here."

    American female: Festival + us1 mbrola voice.
    British male: Festival + en1 mbrola voice.
    American male: Festival (don_diphone voice).
    American male: Festival (kal_diphone voice).

Sentence: "I'm going to throw a nade."

    American female: Festival + us1 mbrola voice.
    British male: Festival + en1 mbrola voice.
    American male: Festival (don_diphone voice).
    American male: Festival (kal_diphone voice).

Spanish:

Sentence: "Tengo la bandera. ¿Alguien puede cubrirme?"

    Spanish male: Festival (el_diphone voice).
    Spanish male: ircHa + es1 mbrola voice.

Sentence: "Hay un francotirador en los alrededores."

    Spanish male: Festival (el_diphone voice).
    Spanish male: ircHa + es1 mbrola voice.

Sentence: "Voy a lanzar una granada."

    Spanish male: Festival (el_diphone voice).
    Spanish male: ircHa + es1 mbrola voice.

7. Acknowledgements.

    I would like to thank _sz_ for his help and interest in this program. Without him, probably Q3Speech wouldn't work under Windows yet.
    Also I would like to thank NaKiLLo, who show me the logfile command.
    Thanks to the True Combat boys (and girls ;)) for many hours of entertainment.
    And many thanks to all the people around in my life! I'm sorry if you don't speak spanish, but "¡donde esté un chato, que se quite un chat!" :D.


    Well, that's all. Maybe this script will be useful, maybe not, but at least is a funny thing to show your friends. Happy fragging!

Carlos Palencia, ©2003.
radpc007@yahoo.es
Hosted at:
SourceForge.net Logo
This page was last updated in Dec, 2003.