wiki:HMMVoiceCreationMary4.0

Version 4 (modified by marcela_charfuelan, 15 years ago) (diff)

--

Voice Import Tools Tutorial : How to build a HMM-based voice for the MARY 4.0 platform (DRAFT)

For creating HMM-based voices we use a version of the speaker dependent training scripts provided by HTS that was adapted to the MARY 4.0 platform. The steps for building a HMM voice for the MARY platform can be summarised in:

I) Checking the necessary programs and files
II) Data preparation
III) Training of HMM models
IV) Adding a new HMM voice in the Mary system.
V) Creating other voice in German or English (to train a HMM voice with another speech database).
VI) (NEW) Creating other voice in a language different from German or English (US).

The previous steps will be explained below creating a HMM voice using the HTS speaker dependent training demo.

The training scripts used here are the latest versions, that is, it is required HTS_2.1 and SPTK-3.2. Some scripts have been added-modified to:

  • Use MARY instead of festival as text analyzer.
  • Train bandpass voicing strengths and Fourier magnitudes for mixed excitation.

I) Checking the necessary programs and files:

MARY requirements:

HTS requirements: please download and follow the instructions for installing:

  • HTS-2.1_for_HTK-3.4.patch
  • HTK-3.4 When compiling htk it is recommended to set the configuration variable MAXTRLEN :
       ./configure MAXSTRLEN=2048   (This will allow to use long context feature vectors)
    
  • SPTK-3.2
  • HTS-demo_CMU-ARCTIC-SLT (for HTS-2.1)

Other requirements: please download and follow the instructions for installing:

Check if your installed tcl supports snack. In your HTS-demo_CMU-ARCTIC-SLT directory type the following:

  /your-Tcl-path/ActiveTcl-x.x/bin/tclshx.x data/scripts/getf0.tcl

The numbers x.x are the version of your installation, for example in my case is tclsh-8.6
If you get:

  /your-Tcl-path/ActiveTcl-x.x/bin/tclshx.x data/scripts/getf0.tcl
  can't find package snack
    while executing
  "package require snack"

Then you need to install snack manually downloading it from: http://www.speech.kth.se/snack/download.html
un-tar and un-zip the snack package in /your-Tcl-path/ActiveTcl-x.x/lib/, so after unpacked your tcl directory should look like:
/your-Tcl-path/ActiveTcl-x.x/lib/snack2.2/
Now test again with the getf0.tcl file, if you have installed correctly the snack library then the output is the following:

 /your-Tcl-path/ActiveTcl-8.6/bin/tclsh8.6 data/scripts/getf0.tcl
 pitch extract tool using snack library (= ESPS get_f0)
 Usage data/scripts/getf0.tcl ...

One final detail on the name of your tclsh executable, the HTS configure has some problems if the name of your executable is different from tclsh, to avoid this simply create an alias for your tclsh-x.x executable, in my case the soft link looks like:

  cd /your-Tcl-path/ActiveTcl-8.6/bin/
  ln -s tclsh8.6 tclsh

II) Data preparation:

1- Download and un-zip, un-tar the latest speaker dependent training demo for English.

http://hts.sp.nitech.ac.jp/archives/2.1/HTS-demo_CMU-ARCTIC-SLT.tar.bz2 for HTS-2.1

2- Download and unzip the patch file for using MARY instead of Festival as text analyser.

https://mary.opendfki.de/repos/trunk/lib/hts/HTS-2.1-demo_CMU-ARCTIC-SLT_for_Mary-4.0.patch

apply the patch to the HTS-demo_CMU-ARCTIC-SLT directory:

   patch -p1 -d . < HTS-2.1-demo_CMU-ARCTIC-SLT_for_Mary-4.0.patch

3- Create a wav directory.

4- Run the VoiceImport program

First of all you need to set your MARY_BASE directory and then run the program:

   export MARY_BASE="/dir/to/openmary"
   java -jar -Xmx1024m  $MARY_BASE/java/voiceimport.jar

When starting the voiceimport tools please provide information for:

  db.gender    = female
  db.locale    = en_US
  db.marybase  = /path-to-MARY_BASE/ or /path-to-openmary/
  db.voicename = hsmm-slt

If you are not familiar or have problems with the VoiceImport program, please read the instructions in the Voice Import Tools Tutorial: http://mary.opendfki.de/wiki/VoiceImportToolsTutorial

If you want to create another voice in German or English please see the section V below.

Please remember that whenever you are in doubt about the settings of a particular component you can check its corresponding help for a description of the meaning (and possible values) of each variable.

5- Run the HMMVoiceDataPreparation of the HMM Voice Trainer group to check if text, wav and data/raw files are available and in the correct paths. If just data/raw is provided, the program will do the conversion. If no text files are available but data/utts in festival format, the program will do the conversion as well.

6- Run the AllophonesExtractor of the Automatic Labeling group to create the prompt_allophones directory required in the next step. This component requires the MARY server.
CHECK: This component does not have help and the settings editor es empty --- This program NEEDS the MARY server!!!! but it does not report any error if the mary server is not running, it just says 0 files processed???

7- Run the EHMMlabeler component of the Automatic Labeling group to label automatically the wav files using the corresponding transcriptions. This procedure might take several hours. For running EHMMLabeler, please use the settings editor of this component to set, according to your festvox installation, the variable:

   EHMMLabeler.ehmm  = ../festvox/src/ehmm/bin/

8- Run the LabelPauseDeleter component of the Automatic Labeling group. Please use the settings editor of this component to set the variable:

   LabelPauseDeleter.threshold  =  10

9- CHECK: Here do we need to run the TranscriptionAligner??? This program will create the allophones directory! what is the difference between allophones and prompt_allophones???

10- Run the PhoneUnitLabelComputer component of the Labels and Pause Correction group. This procedure will create a phonelab directory.

11- FeatureSelelection creates mary/features.txt, it requires the MARY server running.

12- Run the PhoneUnitFeatureComputer component of the Feature Extraction group to extract context feature vectors from the text data. This procedure will create a phonefeatures directory. For running this component the MARY server should be running as well.

13- Run the PhonelabelFeatureAligner component of the Labels and Pause Correction group. This procedure will verify alignment between "phonefeatures" and "phonelabels".

CHECK: This component does not have help and the settings editor es empty

III) HMM models training:

14- Run the HMMVoiceConfigure component of the HMM Voice trainer group. The default setting values of this component are already fixed for the HTS-demo_CMU-ARCTIC-SLT voice, although some setting depends on your installation, please provide paths for:

  HMMVoiceConfigure.htsPath       = /yourpath/htk-hts2.1/bin
  HMMVoiceConfigure.htsEnginePath = /yourpath/hts_engine_API-1.01/bin
  HMMVoiceConfigure.sptkPath      = /yourpath/SPTK-3.2/bin
  HMMVoiceConfigure.tclPath       = /yourpath/ActiveTcl-8.6/bin
  HMMVoiceConfigure.soxPath       = /yourpath/usr/bin

If running configure for other voice, for example a male German voice, please use the settings editor of this component to set the variables:

  HMMVoiceConfigure.dataSet      =  german_set_name
  HMMVoiceConfigure.speaker      =  speaker_name 
  HMMVoiceConfigure.lowerF0      =  40  (male=40,  female=80)  
  HMMVoiceConfigure.upperF0      =  280 (male=280, female=350)

Using the settings editor of this component you can also change other variables like using LSP instead og MGC, sampling frequency, etc., the same as you would do when running "make configure + parameters" with the original HTS scripts.

15- Run the HMMVoiceFeatureSelection component of the HMM Voice trainer group. This program reads the mary/features.txt file (created in step 11), and generates the file mary/hmmFeatures.txt. This file contains extra features, apart from phone and phonological features, that will be used to train HMMs. When running this program a small set of features will be presented on top, separated by an empty line:

   pos_in_syl
   syl_break
   prev_syl_break
   position_type
   
   accented
   accented_syls_from_phrase_end
   accented_syls_from_phrase_start
   breakindex
   edge
   ...

If you are not sure about using other features, use just the first four, delete the others and save the file.

16- Run the HMMVoiceMakeData component of the HMM Voice trainer group to run the HTS procedure "make data". This procedure require the following files, please use the settings editor of this component to set the variables:

   HMMVoiceMakeData.allophonesFile   = allophones.en_US.xml  # allophones set (language dependent)
   HMMVoiceMakeData.featureListFile  = mary/hmmFeatures.txt  # extra context features used for training HMMs.

The allophones set file is language dependent, an example for US English can be found in openmary/lib/modules/en/us/lexicon/allophones.en_US.xml
The hmmFeatures.txt is the file created in step 16 and contains additional context features, appart from phone and phonological features, used for training HMMs.

The HMMVoiceMakeData procedure is similar to the original HTS scripts with additional sections for calculating strengths, Fourier magnitudes (for mixed excitation), global variance and composing training data files from mgc, lf0, str and mag files. This component will execute in the data/ directory:

  make mgc lf0 str mag cmp-mary gv-mary gv list scp 

The label directory and the mlf files in MARY are done with the voiceimport tools: HMMVoiceMakeData.makeLabels()
The questions file in MARY is done with the voiceimport tools: HMMVoiceMakeData.makeQuestions()

Particular procedures can be repeated isolated fixing the particular settings for this component. For example, if the procedure that creates strengths (in the str directory) has to be repeated with a different set of filters (data/filters/), please remove the old str directory and set:

  HMMVoiceMakeData.makeSTR       =  1
  HMMVocieMakeData.makeCMPMARY   =  1

all the other variables in 0, and run again the component. (In this case you need to run as well makeCMPMARY because you need to compose again the vectors mgc+lf0+str+mag).

The procedures can be repeated manually as well, going to the data directory and running "make data" or "make str", as is normally done with the original HTS scripts.

NOTE: the Makefile in data/ includes a gv: section to calculate global variance files. In MARY, these files are generated little endian and contain a header of size one short to indicate the size of the vectors it contains.

17- Run the HMMVoiceMakeVoice component of the HMM Voice trainer group, here again particular training steps can be repeated selecting them (setting in 1, all the others in 0) from the settings of this component. This is equivalent to run again:

   perl scripts/Training.pl scripts/Config.pm > logfile &

after modifying the Config.pm file, as is normally done with the original HTS scripts. This component will generate general information about the execution of the training steps. Detailed information about the training status can be found in the logfile in the current directory.

The training procedure can take several hours, please check the log file time to time to check progress.

IV) Adding a new voice in the MARY platform:

18- Run the HMMVoiceInstaller component of the Install Voice group. The default setting values of this component are already fixed for the HTS-demo_CMU-ARCTIC-SLT voice. If you are training other voice please use the settings editor of this component to set:

  
  HMMVoiceInstaller.FeaFile     =  phonefeatures/xx.pfeats
                                   this is an example of a CONTEXTFEATURES file in MARY format for synthesise during start-up. 
  HMMVoiceInstaller.useMixExc   =  true
                                   set this variable to true if using mixed excitation
  HMMVoiceInstaller.useGV       =  true 
                                   set this variable to true if using global variance in parameter generation.

The VoiceInstaller will:

  • Create a new mary config file in: $MARY_BASE/conf/german-hsmm-voice.config
  • Add the files corresponding to this voice in: $MARY_BASE/lib/voices/hsmm-voice/
  • copy one example of phonefeatures for testing the synthesiser: data/phonefeatures/cmu_us_arctic_slt_xxxx.pfeats to $MARY_BASE/lib/voices/hsmm-voice
  • copy the HTS trees: voices/qst001/ver1/*.inf to $MARY_BASE/lib/voices/hmm-voice
  • copy the HTS PDF models: voices/qst001/ver1/*.pdf to $MARY_BASE/lib/voices/hmm-voice
  • copy global variance models (if useGV is set to true): data/gv/gv-*-littend.pdf to $MARY_BASE/lib/voices/hmm-voice
  • copy filter taps for mixed excitation: data/filters/mix_excitation_filters.txt to $MARY_BASE/lib/voices/hmm-voice
  • copy the trickyPhones.txt file, if one was created during training, to $MARY_BASE/lib/voices/hmm-voice

After successfully installing a new voice, it can be used with the mary_server and the mary_client.

V) Creating other voice in German or English.

If using German:

For creating a new German voice it is necessary:

  • a wav or raw directory with the speech files you will use for training the German voice.
  • transcriptions of the files, one text file per speech file, or transcriptions in festival format if available.

Then we use as a base the original HTS-demo_CMU-ARCTIC-SLT directory:

  • Download and un-zip, un-tar the HTS-demo_CMU-ARCTIC-SLT for HTS-2.1
  • Rename this directory as your new voice name, for example german_voice, and delete the directories data/raw and data/utt.
  • Apply the MARY patch to the german_voice directory.
    patch -p1 -d . < HTS-2.1-demo_CMU-ARCTIC-SLT_for_Mary-4.0.patch
  • Move your speech files to this directory, if you have a wav directory, this should be copied in the current directory (german_voice/wav). If you have a raw directory, this should be copied in the data directory (german_voice/data/raw).
  • Move your transcription files to this directory, if you have a text directory containing the transcription of each file in separate files, this should be copied in the current directory (german_voice/text). If you have transcriptions in festival format please copy this directory in the data/utts directory (german_voice/data/utts/).
  • Now run the VoiceImport program and follow the instructions as normal. Provide general settings for:
       db.gender    =  male  (or female)
       db.locale    =  de
       db.marybase  =  /path/to/mary/base/
       db.voicename =  german_voice
    

VI) Creating other voice in a language different from German or English (US).

If you are creating a voice in other language you will need to specify:

  • Minimal NLP components: if you are creating a new voice from scratch, for example following the steps in http://mary.opendfki.de/wiki/NewLanguageSupport, you will need to create Minimal NLP components for the new language. The MARY server should contain minimal NLP components for extracting context features in the new language (phonefeatures directory).
  • Phoneme set: contained in MARY_BASE/lib/modules/xx/lexicon/allophones.xx.xml , where xx corresponds to the new language.
  • Extra context features: during training of HMMs phones, phonological features and extra features are required. Phones and phonological features are specified in the allophones xml file. The extra features can be specified in the mary/hmmFeatures.txt file (step 15).



Marcela Charfuelan
Fri Sep 4 18:03:25 CEST 2009