eGuideDog
free software for the blind

How to Build Festival on Windows

(updated on Mar 12, 2020)

Another document in Chinese: 编译Windows版Festival

Contents

  1. Install Cygwin
  2. Get Festival files
  3. Make makefile for VC
  4. Make patch for Latin-1 supplement like á, é (optional)
  5. Build with VC and fix the errors
  6. Test
  7. Download a pre-built one

1. Install Cygwin

Get it from http:/www.cygwin.com. When selecting what package to install, make sure gcc is included. The Macraigor System GNU Tools may help you to deal with the configuration. Different versions of compiler often bring in different issues. Just for your reference, this document is based on a install file named Macraigor Cygwin 2.0 (cygwinenv-2.00.exe) This version should only be installed at c:\cygwin.

2. Get Festival files

Get following files from: http://festvox.org/packed/festival/latest/

  • speech_tools-1.2.96-beta.tar.gz
  • festival-1.96-beta.tar.gz
  • festlex_CMU.tar.gz
  • festlex_POSLEX.tar.gz
  • festvox_kedlpc16k.tar.gz

In cygwin:

$ cd /cygdrive/c
$ tar xvfz speech_tools-1.2.96-beta.tar.gz
$ tar xvfz festival-1.96-beta.tar.gz
$ tar xvfz festlex_CMU.tar.gz
$ tar xvfz festlex_POSLEX.tar.gz
$ tar xvfz festvox_kedlpc16k.tar.gz

festlex... and festvox... are the voice and lexicon files you need. Do not use winzip to unpack the voices it corrupts them!

3. Make makefile for VC in Cygwin

There is a INSTALL file which explain more detail in speech_tools-1.2.96-beta.tar.gz

We mention key procedures here:

$ cd speech_tools
$ ./configure
$ make VCMakefile
$ cp config/vc_config_make_rules-dist config/vc_config_make_rules
$ cd ../festival
$ ./configure
$ make VCMakefile
$ cp config/vc_config_make_rules-dist config/vc_config_make_rules

Finally make festival init_modules code. (If you add new modules you either need to edit init_modules.cc by hand or rerun this step.)

$ make -C src/modules init_modules.cc

Modify config/vc_config_make_rules

Change "SYSTEM_LIB=c:\\festival\\lib" according to where you extract Festival. Add "/MTd" (multi-thread debug) to DEBUGFLAGS if you want to build a lib for debugging (but this flag seems cause building failure in Festival 2.5).

4. Make patch for Latin-1 supplement like á, é (optional)

This patch has no effect on English but most other languages which has characters whose Unicode is between 128 and 256.

Replace speech_tools/siod/slib_str.cc with slib_str.cc with Latin-1 supplement patched and speech_tool/base_class/string/EST_String.cc with est_string with Latin-1 supplement patched.

(I've tried to push this patch to upstream but fail to contact the maintainers of Festival)

5. Build with VC and fix the errors

VC6 seems work not so well. We recommend to use VS2005. And it should not be able to build with VS2015+ (Festival maintainer didn't write Makefile for new Visual Studio)

Run the following command in Windows command line mode to set VC environment.

> C:\Program Files\Microsoft Visual Studio 8\VC\bin\VCVARS32.BAT

Compile with VC

> cd c:\speech_tools
> nmake /nologo /FVCMakefile

There may be an error in EST_wave_io.cc. It complains that "const char *" cannot convert to "char *". Adding explicit conversion "(char *)" should be all right.

There may be a bug from line 74 to 77 of speech_tools/utils/EST_cutils.c

if (((tdir=getenv("TMPDIR")) == NULL) ||
	((tdir=getenv("TEMP")) == NULL) ||
	((tdir=getenv("TMP")) == NULL))
	tdir = "/tmp";

It should be:

if (((tdir=getenv("TMPDIR")) == NULL) &&
	((tdir=getenv("TEMP")) == NULL) &&
	((tdir=getenv("TMP")) == NULL))
	tdir = "/tmp";

Or tdir will be /tmp unless all three variables (TMPDIR, TEMP and TMP) are set. This bug affects Festival running on Windows because it will complain when fail to write /tmp/est_xxx. This bug has been fixed in speech_tools' CVS.

If you get error of "stdint.h: no such file or directory", download one from http://msinttypes.googlecode.com/svn/trunk/stdint.h to include/ directory.

If you get "error C3861: 'snprintf': identifier not found", try to include win32/EST_iostream_win32.h in that file.

If you get "error C3861: 'random': identifier not found", try to change random() to rand().

> cd ..\festival
> nmake /nologo /FVCMakefile

There may be another error in EST_FlatTargetCost.h and EST_FlatTargetCost.cc. It complains that "WORD" and "PWORD" are redefined. We can change all relative "WORD" to "MY_WORD" and all relative "PWORD" to "MY_PWORD".

6. Test

> echo "hello world" | C:\festival\src\main\festival --tts

7. Download a pre-built one

Forget all things above, I've built it for you :)

(Latin-1 supplement patch is not included)

festival-1.96.03-win.7z   festival-2.1-debug.tar.xz   festival-2.1.1-win.7z   festival-2.4-win.7z   festival-2.5-win.7z   speech_tools-2.5-win.7z

Pay attention! The default folder of Festival is C:\festival. You need to specify "--libdir" when running festival if you extract the package in another folder.

Wish you good Luck!

Cameron Wong