# FestVox To FreeTTS

As of FreeTTS 1.2, FreeTTS provides support to import voice data directly from FestVox. The process currently works well for US English voices, but you are definitely encouraged to try to help us make it work for other locales. This page describes the overall process for doing the import.

### Creating a Voice

You must first create a voice using FestVox. We've had success using FestVox 2.0 on both Linux (RedHat 9.0) and Solaris (use gcc 3.2.2 to compile FestVox and Festival on Solaris). NOTE that we did not create FestVox, nor can we provide support for it. The creators of FestVox, however, did a great job and you can refer to their documentation for where to send any questions or comments.

FestVox currently provides support for creating two types of voices: diphone and unit selection. The diphone voices support general domain synthesis (i.e., they try to speak any text you throw at them). They are time consuming to create, and are usually not a good first choice when learning how to create voices. The unit selection, or limited domain, voices only support a limited somain (e.g., telling the time), and generally sound very good.

If you want to experiment with voice creation and conversion, we recommend you start with creating a time telling voice.

Please refer to the FestVox Documentation for information on creating a voice. Section IV.19 of the FestVox documentation provides a good tutorial on making a US Diphone voice, and Section II.5.6 provides a good tutorial on recording a cluster unit voice for the limited domain of telling the time. Section II.5 provides a good general explanation of creating a limited domain voice in general.

### Importing a FestVox Voice into FreeTTS

FreeTTS follows many of the same steps that Flite follows for importing voices. For a more detailed description of the process, please read Section 8 of the Flite documentation.

To import a voice into FreeTTS, you first need to do the following things:

1. Compile Festival 1.4.3 and FestVox 2.0 as well as the speech tools that come with Festival. Refer to the Festival documentation for details of setting this up on your system. We've only built Festival and FestVox on RedHat 9.0 and Solaris. For both systems, we used gcc 3.2.2.
2. "festival", "ant", "java", and "javac" must be in your path. For example, we used the following command under bash on RedHat (modify appropriately):

   `export PATH=/usr/java/j2sdk1.4.2/bin:/home/jim/festival/bin:/usr/java/apache-ant-1.5.4/bin:$PATH`

3. You must set the ESTDIR environment variable to point to the speech tools. For example:

   `export ESTDIR=/home/jim/speech_tools`

To convert a voice, run the `FestVoxToFreeTTS.sh` script from a command line prompt located in the `tools/FestVoxToFreeTTS` directory:

`FestVoxToFreeTTS.sh <voicedir>`

where <voicedir> is the directory the FestVox voice resides in. The contents of will looks something like the following:

    bin/  etc/       FreeTTS/  lpc/     prompt-cep/  recording/  wav/
    cep/  f0/        group/    mcep/    prompt-lab/  scratch/    wavn/
    dic/  festival/  lab/      pm/      prompt-utt/  sts/        wrd/
    emu/  festvox/   lar/      pm_lab/  prompt-wav/  versions/

The script will automatically detect whether it is a cluster unit voice or a diphone voice by looking at the <voicedir>/etc/voice.defs file. If no such file exists, you will need to create it. An example for a time-telling voice would be something like the following:

    FV_INST=sun
    FV_LANG=time
    FV_NAME=dtv
    FV_TYPE=ldom
    FV_VOICENAME=$FV_INST"_"$FV_LANG"_"$FV_NAME
    FV_FULLVOICENAME=$FV_VOICENAME"_"$FV_TYPE

If possible, you can let festival automatically generate this for you. Try <`festvoxdir>/src/general/guess_voice_defs`.

FreeTTS will create a new directory `<voicedir>/FreeTTS/`. In that directory is the text which contains all the data for the voice (along with a few other intermediate files). The voice file will have a name such as `sun_time_dtv.txt`.

The various stages of the conversion process can be called directly by passing a second argument to `FestVoxToFreeTTS.sh` such as "sts" or "mcep". These should be used carefully. More information on these stages can be found in the Flite documentation.

If you do not pass a second argument (recommended) the conversion tool will run the processing stages in the following order: "lpc", "sts", "mcep" (if a cluster unit voice), "idx", "install", and "compile". The "install" and "compile" are specific to FreeTTS and are not mentioned in the Flite documentation. They are the stages that construct the framework for the voice within freetts and compile the result.

When the process gets to the install phase, you will encounter a menu. The install phase only knows how to handle US English voices. If you have any other languages/locales, then you should probably exit at this step. Unfortunately adding new languages or locales is beyond the scope of this document.

The menu allows you to define various features about the voice:

- Name: The name you want to call this voice. For example "kevin", "kevin16", "alan", or "dave".
- Gender: The gender of the voice. Select help from the menu for a full listing of genders.
- Age: The age of the voice. Select help from the menu for a full listing of ages.
- Description: A sentence or so that describes this voice for others.
- Full Name: - The name that will be used to name the voice files and directory. DON'T USE SPACES. It must be unique to this installation of FreeTTS as well as any other copy of FreeTTS you expect to use this voice. For the sake of similarity to other voices, it is highly recommended to not change this property unless it conflicts with an existing voice. The format for the name follows the convention: `<domain>_<locale>_<name>`. The <name> does not have to match the Name property. The domain generally matches an Internet domain or some other globally unique identity. For limited domain voices, you might use the limited domain name instead of locale. Example names include `cmu_us_kal`, `cmu_time_awb`, and `sun_us_dtv`.
- Domain: The domain if this is a limited (ldom) voice, otherwise it must be set to "general".
- Organization: The organization which recorded the voice. For example "cmu" or "sun".

If there already exists a voice with the same Full Name, you are given the option to over-write it, cancel, or change the properties.

When this is done, the voice is put into the FreeTTS directory structure `<FreeTTSdir>/com/sun/speech/freetts/en/us/<voice Full Name>`. It is recommended to visit this directory and confirm that everything looks correct; there should be four files similar to the following:

        README                 - Information about the voice
        sun_time_dtv.txt       - The imported voice data in ASCII format
        voice.Manifest         - The Manifest file with which to create the jar file
        DtvVoiceDirectory.java - The VoiceDirectory for this new voice

If this is a limited domain voice for something other than the cmu time domain, then you will likely have to make some changes to make it look at the correct lexicon.

As part of the import process, the FestVoxToFreeTTS.sh script will create the jar file for the voice. If you wish to create the jar file manually, you can run one of the following commands, depending upon the type of voice you have imported (substitute the Full Name of the voice you imported):

        ant -Dclunit_voice=sun_time_dtv -find build.xml
        ant -Ddiphone_voice=sun_us_dtv -find build.xml

The compiled voice is put in `<FreeTTSdir>/lib/<voice Full Name>.jar`.

The voice will automatically be added to the list of available voices for FreeTTS.

You can now test your voice with:

`java -jar lib/freetts.jar myvoicename` (general domain)

`java -jar bin/JTime.jar myvoicename` (time domain)

where myvoicename is the name property you assigned to your voice in the "install" phase. If you've forgotten the name, you can always retrieve it by executing the jar file for your voice:

`java -jar lib/<voice Full Name>.jar`

### Files in this directory

- FestVoxToFreeTTS.sh: The bash script that performs the conversion process.
- FestVoxClunitsToFreeTTS.scm: Performs the idx stage of the conversion for cluster unit voices.
- FestVoxDiphoneToFreeTTS.scm: Performs the idx stage of the conversion for diphone voices.
- qsort.scm: A simple quicksort implementation in scheme.
- FindSTS.java: Generates the sts file for a given recording. Used by FestVoxToFreeTTS.sh.
- FindSTS.jar: A compiled version of FindSTS.java (automatically generated)
- README: This file.
- CMU_USDiphoneTemplate.java: A template voice directory for en/us diphone voices.
- CMU_USTimeTemplate.java: A template voice directory for en/us time limited domain cluster unit voices.
- VoiceMakefileTemplate.txt: A template Makefile for both ldom and diphone voices.

See the license terms and acknowledgments.
Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.