= '''Voice Import Tools Tutorial : How to build a HMM-based voice for MARY 4.1.0 TTS system''' = For creating HMM-based voices we use a version of the speaker dependent training scripts provided by [http://hts.sp.nitech.ac.jp/ HTS] that was adapted to the MARY 4.1.0 platform. The steps for building a HMM voice for the MARY platform can be summarised in:[[BR]] I) Download MARY TTS including Voice import tools[[BR]] II) Check necessary programs and files[[BR]] III) Check data: audio and text files[[BR]] IV) Run the Voice import tools [[BR]] V) Creating other voice in a language different from German or English (US). 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:[[BR]] - Use MARY instead of festival as text analyzer.[[BR]] - Train bandpass voicing strengths and Fourier magnitudes for mixed excitation.[[BR]] '''MARY requirements:'''[[BR]] - Operating System - Linux (tested on Ubuntu 9.04) [[BR]] - MARY TTS 4.1.0 including Voice import tools during installation - link: [http://mary.dfki.de/download/4.0/openmary-standalone-install-4.1.0.jar MARY TTS 4.1.0] [[BR]] ''' == I) Download MARY TTS including Voice import tools == ''' Click on the latest MARY release [http://mary.dfki.de/download/4.0/openmary-standalone-install-4.1.0.jar MARY download] or download the file and run it with: {{{ java -jar openmary-standalone-install-4.1.0.jar }}} ''' == II) Check the necessary programs and files: == ''' We provide an script to facilitate the checking and installation of the necessary external programs, once installed MARY TTS open a command line shell in your voice building directory and run the shell script: {{{ $MARY_BASE/lib/external/check_install_external_programs.sh }}} With the option '''-check''', this script will check if the necessary programs and versions are installed (that is, the programs can be found in the PATH or in the paths provided by the user).[[BR]] With the option '''-install''' this script will try to download and install the necessary programs in: $MARY_BASE/lib/external/bin (if problems, it will suggest how to install manually the programs). If you have already installed some of the required programs, '''please include their paths in the PATH variable or provide the paths''', for example: {{{ $MARY_BASE/lib/external/check_install_external_programs.sh -check /your/path/to/htk/bin /your/path/to/Festival/festvox/src/ehmm/bin }}} This script generates a '''$MARY_BASE/lib/external/externalBinaries.config''' file that will be used by the Voice import tools to locate the necessary external programs. The necessary programs that this script checks are:[[BR]] '''HTS requirements:'''[[BR]] - [http://hts.sp.nitech.ac.jp/archives/2.1/HTS-2.1_for_HTK-3.4.tar.bz2 HTS-2.1_for_HTK-3.4.patch] [[BR]] - HTK-3.4 and HDecode patched with HTS-2.1_for_HTK-3.4.patch links: * [http://htk.eng.cam.ac.uk/ftp/software/HTK-3.4.tar.gz HTK-3.4] (you will need to register first) [[BR]] * [http://htk.eng.cam.ac.uk/prot-docs/hdecode.shtml HDecode] (you will need to register first) [[BR]] - [http://downloads.sourceforge.net/sp-tk/SPTK-3.2.tar.gz SPTK-3.2] [[BR]] - [http://downloads.sourceforge.net/hts-engine/hts_engine_API-1.01.tar.gz hts_engine_API-1.01] [[BR]] '''Other requirements:'''[[BR]] - awk normally available in linux [[BR]] - perl normally available in linux [[BR]] - bc normally available in linux [[BR]] - sox, v13.0 or greater [http://sox.sourceforge.net/ SoX], normally available in linux. [[BR]] - tcl supporting snack, for example [http://www.activestate.com/Products/ActiveTcl/ ActiveTcl.] Note that only ActiveTcl 8.4 includes snack; 8.5+ requires manual installation. [[BR]] - [http://www.speech.kth.se/snack/download.html snack] library for tcl. [[BR]] - EHMM for automatic labeling, available with [http://festvox.org/download.html festvox-2.1] [[BR]] ''' == III) Check data: audio and text files[[BR]] == ''' In your voice building directory execute the step-by-step procedure in [http://mary.opendfki.de/wiki/VoiceImportToolsTutorial VoiceImportToolsTutorial] to make sure that the data, sound (wav) and text files are in the correct place and format.[[BR]] As a result of this step your voice building directory should contain a wav and text directories. ''' == IV) Run the Voice Import tools == ''' In your voice building directory run the voice import tools: {{{ export MARY_BASE="/your/path/to/MARY TTS/" java -Xmx1024m -jar $MARY_BASE/java/voiceimport.jar }}} After starting the Voice Import Tools check the global settings of the voice, make sure that the allophones file is provided and exists: {{{ db.alophonesSet = $MARY_BASE/lib/modules/xx/lexicon/allophones.xx.xml (where xx is the corresponding language) }}} And run the following components: '''1-''' 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. [[BR]] '''2-''' Run the EHMMlabeler component of the Automatic Labeling group to label automatically the wav files using the corresponding transcriptions. If the pauses at the beginning and end of your recordings are longer than 0.2 seconds, you might consider to reduce these pauses using the tool: Convert recorded audio (as explained in [wiki:NewLanguageSupport NewLanguageSupport] No. 9) to trim initial and final silences.[[BR]] The EHMMLabeler 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/ }}} The result of this step is a '''ehmm/lab''' directory. '''3-''' Run the LabelPauseDeleter component of the Automatic Labeling group. Please use the settings editor of this component to set the variable: {{{ LabelPauseDeleter.threshold = 10 }}} The result of this step is a '''lab''' directory. '''4-''' Run the TranscriptionAligner component of the Label-Transcript Alignment group. This program will create the '''allophones''' directory. '''5-''' Run the PhoneUnitLabelComputer component of the Label-Transcript Alignment group. This procedure has as input the '''lab''' directory and will create as an output the '''phonelab''' directory. '''6-''' Run the FeatureSelelection component of the Feature Extraction group. This program will create a '''mary/features.txt''' file, it requires the MARY server running. Select here all the features and save the file. '''7-''' 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. '''8-''' Run the PhonelabelFeatureAligner component of the Verify Alignment group. This procedure will verify alignment between "phonefeatures" and "phonelabels".[[BR]] As a result of previous steps we should have:[[BR]] - phonefeatures directory [[BR]] - phonelab directory [[BR]] - mary/features.txt file [[BR]] - $MARY_BASE/lib/external/externalBinaries.config ''' === HMM models training: === ''' '''9-''' Run the HMMVoiceDataPreparation of the HMM Voice Trainer group to set up the environment to create a HMM voice and check if required external programs and text and wav files are available and in the correct paths. '''10-''' Run the HMMVoiceConfigure component of the HMM Voice trainer group. The default setting values are already fixed for the arctic slt voice, some path settings depend on your installation, and will be taken from $MARY_BASE/lib/external/externalBinaries.config 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. '''11-''' Run the HMMVoiceFeatureSelection component of the HMM Voice trainer group. This program reads the '''mary/features.txt''' file (created in step 6), and generates the file '''mary/hmmFeatures.txt'''. The hmmFeatures.txt file contains extra features, apart from phone and phonological features, that will be used to train HMMs. Select on the window extra features for training or simply copy on the window the following:[[BR]] {{{ accented next_tobi_endtone onsetcoda prev_accent next_is_pause tobi_accent syl_break pos_in_syl stressed prev_syl_break segs_from_word_start selection_prosody prev_is_pause next_tobi_accent syls_from_phrase_start words_from_phrase_start tobi_endtone }}} Delete other features and save. '''12-''' Run the HMMVoiceMakeData component of the HMM Voice trainer group to run the HTS procedure "make data". This procedure require the following files: {{{ 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, it can be found in $MARY_BASE/lib/modules/en/us/lexicon/allophones.en_US.xml[[BR]] The hmmFeatures.txt is the file created in step 15 and contains additional context features, apart from phone and phonological features, used for training HMMs.[[BR]] 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 hts/data/ directory: {{{ make all-mary or make mgc lf0 str-mary mag-mary cmp-mary gv-mary gv list scp }}} The '''label''' directory and the '''mlf''' files in MARY are done with the Voice Import Tools: HMMVoiceMakeData.makeLabels()[[BR]] The '''questions''' file in MARY is done with the Voice Import 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/), 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 makeCMPMARY again because you need to compose again the vectors mgc+lf0+str+mag). The procedures can be repeated manually as well, going to the hts/data directory and running "make str-mary" and "make cmp-mary". 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. '''13-''' 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. ''' === Adding a new voice in the MARY platform: === ''' '''14-''' Run the HMMVoicePackager component of the Install Voice group. The default setting values of this component are already fixed for the HTS-demo_CMU-ARCTIC-SLT voice. Some settings of the voice can be changed here, for example: {{{ HMMVoicePackager.useMixExc = true set this variable to true if using mixed excitation HMMVoicePackager.useGV = true set this variable to true if using global variance in parameter generation. HMMVoicePackager.useAcousticModels = true set this variable to true to allow prosody modification specified in MARYXML }}} The HMMVoicePackager will pack in a zip file located in MARY_BASE/download the following files: [[BR]] - A mary config file: german-hsmm-voice.config [[BR]] - HMM files corresponding to this voice: - one example of phonefeatures for testing the synthesiser: data/phonefeatures/cmu_us_arctic_slt_xxxx.pfeats [[BR]] - the HTS trees: voices/qst001/ver1/*.inf [[BR]] - the HTS PDF models: voices/qst001/ver1/*.pdf [[BR]] - global variance models (if useGV is set to true): data/gv/gv-*-littend.pdf [[BR]] - filter taps for mixed excitation: data/filters/mix_excitation_filters.txt [[BR]] - trickyPhones.txt file, if one was created during training [[BR]] After successfully packing a new voice, you must run the MARY Component Installer to install the voice! ''' === V) 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 NewLanguageSupport], you will need to create Minimal NLP components for the new language. These minimal components are necessary to run the MARY server in the new language and extract context features ('''phonefeatures''' directory). - '''Phoneme set''': contained in $MARY_BASE/lib/modules/xx/lexicon/allophones.xx.xml , where xx corresponds to the new language. - After creating the minimal components, you will need wav files (in a wav directory) and the corresponding transcriptions (one file per wav file in a text directory). [[BR]] Afterwards follow the instructions as normal from step 1. Provide general settings for: {{{ db.gender = male (or female) db.locale = new_language locale (according to your minimal NLP components, ex. tr for Turkish, te for Telugu, etc.) db.marybase = /path/to/mary/base/ db.voicename = new_language_voice_name }}} [[BR]] [[BR]] Marcela Charfuelan[[BR]] Wed Sep 1 12:15:40 CEST 2010