Click here to register.

Run Acoustic Model Creation Script

Make sure you have the following HTK scripts to your 'voxforge/HTK_scripts' folder:

  • maketrihed;
  • mkclscript.prl;
  • prompts2mlf;
  • prompts2wlist.

Create a new folder in your voxforge and call it 'scripts'.  Extract the following tar file to your 'voxforge/auto/scripts folder:

scripts.tgzscripts.tgz

Run the HTK_Compile_Model_sh script:

$ cd  voxforge/auto/scripts
$./HTK_Compile_Model.sh

This will create the following files (located in the auto/acoustic_model_files folder) that make up your acoustic model:


Note: the hmmdefs file shown here was trained with my voice.  It will not work with your voice.  Your file will have a the same structure as this one, but the statistics will be different.
 

 


Comments

Click the 'Add' link to add a comment to this page; click the 'Read More' link to view replies to a posted comment.

AddSearch

Running HTK_Compile_Model.sh on Ubuntu
By Vivek Kapoor - 7/2/2008

You may encounter the following errors if you try to run ./HTK_Compile_Model.sh on Ubuntu

==./HTK_Compile_Model.sh: 215: let: not found

If you are fast enough to press CTRL+C, you may also notice something like

-e     init

on the top.  This is because Ubuntu's sh command in /bin is mapped to /bin/dash instead of /bin/bash. Doing the following will sort out the issue

sudo rm /bin/sh

sudo  ln -s /bin/bash /bin/sh

How to speed up Step 7 of the script
By kmaclean - 6/19/2008

from this post:

Ken,

Here is my update of Step 7 fragment of the script:

 

make_hmm4 () {
    LINE="start"
    NUM=1

 rm -rf ./interim_files/hmm4/hmmdefs.tmp1
 rm -rf ./interim_files/hmm4/hmmdefs.tmp2
 
    while [ `echo ${LINE} | awk '{ print $1 }'` != "" ];
    do
  LINE=`cat -n ./interim_files/hmm4/hmm_sil | grep ^[[:space:]]*${NUM}[[:space:]] | sed s/^[[:space:]]*[[:digit:]]*//g`
  if [ `echo ${LINE} | awk '{ print $2 }'` = "\"sil\"" ]; then
            while [ `echo ${LINE} | awk '{ print $1 }'` != "<ENDHMM>" ];
            do
                echo ${LINE} >> ./interim_files/hmm4/hmmdefs.tmp1
                echo ${LINE} >> ./interim_files/hmm4/hmmdefs.tmp2
#    print_process ${NUM}
    let "NUM += 1"
    LINE=`cat -n ./interim_files/hmm4/hmm_sil | grep ^[[:space:]]*${NUM}[[:space:]] | sed s/^[[:space:]]*[[:digit:]]*//g`
   done
   
   echo ${LINE} >> ./interim_files/hmm4/hmmdefs.tmp1

   NUM2=1
   while [ ${NUM2} != "28" ];
   do
    LINE2=`cat -n ./interim_files/hmm4/hmmdefs.tmp2 | grep ^[[:space:]]*${NUM2}[[:space:]] \
    | sed s/^[[:space:]]*[[:digit:]]*//g`

      case ${NUM2} in
     1 )
      echo ${LINE2} | sed s/~h\ \"sil\"/~h\ \"sp\"/g >> ./interim_files/hmm4/hmmdefs.tmp1
      ;;
     2 )
      echo ${LINE2} >> ./interim_files/hmm4/hmmdefs.tmp1
      ;;
     3 )
      echo ${LINE2} | sed s/5/3/g >> ./interim_files/hmm4/hmmdefs.tmp1
      ;;
     10 )
      echo ${LINE2} | sed s/3/2/g >> ./interim_files/hmm4/hmmdefs.tmp1
      ;;
     11 | 12 | 13 | 14 | 15)
      echo ${LINE2} >> ./interim_files/hmm4/hmmdefs.tmp1
      ;;
     22 )
      echo ${LINE2} | sed s/5/3/g >> ./interim_files/hmm4/hmmdefs.tmp1
      ;;
     24 )
      echo "0.000000e+000 1.000000e+000 0.000000e+000" >> ./interim_files/hmm4/hmmdefs.tmp1
      ;;
     25 )
      echo "0.000000e+000 0.900000e+000 0.100000e+000" >> ./interim_files/hmm4/hmmdefs.tmp1
      ;;
     26 )
      echo "0.000000e+000 0.000000e+000 0.000000e+000" >> ./interim_files/hmm4/hmmdefs.tmp1
      ;;
    esac
    let "NUM2 += 1"
   done
        fi
  echo ${LINE} >> ./interim_files/hmm4/hmmdefs.tmp1
#  print_process ${NUM}
  let "NUM += 1"
 done
 cat ./interim_files/hmm4/hmm_before_sil ./interim_files/hmm4/hmmdefs.tmp1 > ./interim_files/hmm4/hmmdefs
 rm -rf ./interim_files/hmm4/hmmdefs.tmp1
 rm -rf ./interim_files/hmm4/hmmdefs.tmp2
 rm -rf ./interim_files/hmm4/hmm_before_sil
 rm -rf ./interim_files/hmm4/hmm_sil
 return 0
}

extract_sil_model(){
   SWITCH=0
 BEGIN=0
 NUM2=0
 for TOKEN in `cat -n ./interim_files/hmm4/hmmdefs `
 do
  if [ "${TOKEN}" = "\"sil\"" ]; then
   SWITCH=1
  fi
  if [ "${SWITCH}" = "1" ]; then
   YES=$(echo $TOKEN | grep ^[[:digit:]+])
   if [ "1${YES}1" != "11" ]; then #### supposed to be [ $YES !=  ]; but didn't work ?
    SWITCH=0
    BEGIN=$TOKEN
   fi
  fi
 done
 TOKEN=`wc ./interim_files/hmm4/hmmdefs | awk '{ print $1 }'`
 END=$TOKEN
 let NUM=END-BEGIN+2
 tail -$NUM ./interim_files/hmm4/hmmdefs > ./interim_files/hmm4/hmm_sil
 let NUM=BEGIN-2
 head -$NUM ./interim_files/hmm4/hmmdefs > ./interim_files/hmm4/hmm_before_sil
 return 0
}

.......

print_heading "Step 7 - Fixing the Silence Model"
 cp ./interim_files/hmm3/. ./interim_files/hmm4 -R
 echo -e 'making hmm4\n'
 extract_sil_model
 make_hmm4 2> /dev/null
.......

Script assumes that sil model is located at the bottom of hmmdefs file. I think it can be modified to be valid for any location inside hmmdefs file.

It works much faster for me - about 30 sec instead of 10 min.

Thanks,

Yessil

Execution stops at step 5
By colbec - 3/5/2008 - 1 Replies

The first time I ran HTK_Compile_Model.sh it stopped at step 5 and complained that it could not find sample1.wav. The message indicated it was looking in a directory one level up, but the Howto calls for the wav files to be stored two levels up in voxforge/train/wav directory. 

I found that after:

mkdir auto/train and mkdir auto/train/wav,

copy all sample*.wav files to this new wav directory

mkdir auto/train/mfcc

then the script ran perfectly to the end. Maybe I missed something, but hope it helps.

STEEP 5 MISSING
By kat_wills - 12/28/2007 - 1 Replies Hi,
Step 4 made a reference on step 5,but it does not appear as if it exist.So when I ran the 'script' step, /HTK_Compile_Model.sh,it gave error.The step made reference to 'auto/acoustic_model_files folder' which did not exists.It appears some steps are missing in the linux tutorial.

Any help will be appreciated.

Thanks