How to configure HTS demo with STRAIGHT features for 16kHz training data

I have been using HTS for a while for my research on speech synthesis. Recently, I have had some problems when I tried to configure the HTS demo with STRAIGHT features to use 16k data instead of 48k. I finally figured out how to properly do that work, and it is really not as easy as changing one or two configurations like in other demoes without STRAIGHT, so I decided to note all the steps down here.

Normally, we will have to change the makefile in the data folder and make some small modifications the Config.m and Training.pl file in the scripts folder (we can also change the .in files directly as well).

makefile for training data

Obviously, we will have to change SAMPFREQ to 16000, FRAMESHIFT to 80 (if you want to keep the 5ms shifting interval) and FREQWARP to 0.42. We might also change the LOWERF0 and UPPERF0 if necessary.

You may realize that this makefile does not have a FRAMELEN configuration like in other demo. Actually the frame length is fixed at 2048 and is written directly as a MGC extraction parameter:

I am still not sure why FRAMESHIFT configuration is provided by FRAMELEN is not, but since the SP feature dimension changes (from 1025 to 513) when we change frame shift to 80, we will also have to change this frame length to get correct MGC from the new SP inputs. Therefore, we could introduce a FRAMELEN = 1024 configuration and replace all the 2048 parameter by the new length.

So below is the final speech analysis configuration (I also changed lower f0 to 50Hz for male voice):

And the calls to MGCEP and LPC2LSP will be changed too (to add the FRAMELEN configuration):

We still have not finished yet. The BAP part, although does not have any configurable parameters, also needs to change. This part is actually reducing the dimension of the AP from 1025 (for 48kHz training data) to 26 by averaging 26 separate bands in the AP. The problem arises when we only have 513 AP features in our experiments with 16kHz data, so the last 3 bands in the BAP files, trying to accumulate more than 513 features, will contain wrong data. We fixed this by scaling down the bandwidth of each band, so that the block copy will not exceed 512. The result is below.

I think we can also modify just 3 last bands (e.g. remove 2 and modify 1), but I am not sure about the effect on resolution power of the first few bands.

Rounding error with STRAIGHT vocoder

There is a rounding  error in STRAIGHT causing some APs and SPs have different numbers of frame for the same sentence. I am still not sure if this would cause problems in the training phase, but to make sure the data is correct, I add one line into the makefile right after ap and sp are returned from STRAIGHT to make sure all the dimensions are consistent:

Config.m

For the Config.m file, we just need to change some variables in the speech analysis part to correspond to the change in the make file: $sr to 16000, $fs to 80, $fw to 0.42

Training.m

We will have to change the gen_wave function at the end of the file, to make sure that the AP is generated correctly. Basically, we will adapt this part according to the changes in the bands and bandwidths in the makefile.

And now you are ready to use your 16kHz data with STRAIGHT vocoder!

4 thoughts to “How to configure HTS demo with STRAIGHT features for 16kHz training data”

  1. Dear Nguyen Quy Hy,

    Thank you very much giving information on how to configure HTS for 16 kHz data. I could follow every thing except the last part. You have mentioned that gen_wave in training.pl need to be modified to make sure that AP is generated properly. Could you please tell me what need to modified for the band and bandwidth you have mentioned above.

    Thanks and regards
    Narendra N P

    1. You must have noticed that I have changed the bandwidth of the 26 aperiodicity bands (approximately half of those in the demo).
      So when recreating the aperiodicity (AP) from the banded AP, you should also half the bandwidth here (right inside the gen_wave function).

      However, I found that STRAIGHT can still regenerate the wave form without any modification to the gen_wave function, which means the generated AP will be double the dimension of the training data. Therefore, unless you are trying to use the AP features for further processing, you can just ignore that step.

  2. Dear Nguyen Quy Hy,
    Thank you very much. I follow your guide to configure hts for 16k, but in “Make file for training data” I don’t know how to scaling down the bandwidth of each band, so the block copy will not exceed 512.Could you please detail how to do that.
    Thanks and regards
    Nguyễn Văn Thịnh

Leave a Reply to Narendra N P Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.