Text to Speech
Text to speech (as it applies to the Source engine) is the technology of turning raw text into actual audio. Currently, Valve doesn't use TTS in any of its games, instead using voice actors for all of its spoken dialogue. However, TTS technology is coming along well, and is now at a point where it can be useful for more experimental/research-oriented Source mods. Furthermore, it can be used as place holders for audio that will be recorded by actors later. TTS also has the nice property that, because it is generated by the computer, we can do all the lip-syncing automatically, without the need for running the file through FacePoser.
Python
hl2TTS is an awkwardly named Python module that can handle everything necessary to automatically generate WAVs in the correct format and with the lip-synching information attached. These files are ready to be played in HL2 (after being added to script files of course.) It is a bit of a pain to get this file going because of the various dependencies, but once it's running it's straightforward to use. To use this module, you will need to do the following:
- Have a basic understanding of Python. The code is obvious to use, but you do need to open it in a Python editor (IDLE works fine.) It'd be nice to have a just an .EXE that will run the script, but it hasn't happened yet. In the meantime, a 20 minute Python tutorial will get you up and running just fine.
- Install Microsoft SAPI 5.1. This is the same package you need for doing lip-synching in FacePoser, so you may have it already. This is the package that actually does the generation.
- Install the Python Win32 Extensions. This allows pyTTS (the Python wrapper library for SAPI) to correctly link the DLLs.
- Install pyTTS. This is a nice wrapper library from the good people at UNC that allows us to use SAPI from within Python very easily.
You are now ready to use hl2TTS.py. Import the module, and then use the StraightForwardRecord function. For instance, if you're at an interactive Python prompt, do: >>> import hl2TTS >>> hl2TTS.StraightForwardRecord("The quick brown fox jumped over the lazy dog.", "c:\\test")
This will generate a lip-synched audio file named c:\test0.wav of a computerized voice speaking the words "The quick brown fox jumped over the lazy dog."