‹ projects

vmc

a voice model creator for CMU Sphinx
Log | Files | Refs | README | LICENSE

voicemodel.sh (2942B)


      1 #!/bin/bash
      2 # 
      3 # DESCRIPTION =================================================================
      4 # 
      5 #       Given acoustic feature files and sentence file derivatives, produce 
      6 #       voice model. 
      7 #
      8 #       This script is primarily using a copy of en-us that is being actively 
      9 #       edited as it is adapted to become a custom voice model.  
     10 # 
     11 #       Binaries are located in /opt/vmc/lib.
     12 # 
     13 # USAGE EXAMPLE ===============================================================
     14 # 
     15 #       bash voicemodel.sh \
     16 #            'en-us' \
     17 #            /usr/local/lib/python2.7/dist-packages/pocketsphinx/model/en-us \
     18 #            ~/.psyche/audio 
     19 # 
     20 # VARIABLES ===================================================================
     21 
     22 model_name=$1          # If performing adaptation, this must match prior names.
     23 acoustic_model_dir=$2  # acoustic model folder, often the default 'en-us'
     24 audio_file_dir=$3      # contains audio file and sentence file derivatives
     25 
     26 libdir=/opt/vmc/lib
     27 
     28 # also located at /opt/vmc/lib/cmudict-en-us.dict
     29 dict="/usr/local/lib/python2.7/dist-packages/pocketsphinx/model/cmudict-en-us.dict"
     30 
     31 # COMMANDS ====================================================================
     32 
     33 # convert binary mdef file to .txt --------------------------------------------
     34 cd $acoustic_model_dir
     35 sudo pocketsphinx_mdef_convert \
     36     -text $acoustic_model_dir/mdef $acoustic_model_dir/mdef.txt #&> /dev/null
     37 
     38 # run tools to create voice model ---------------------------------------------
     39 cd $audio_file_dir
     40 
     41 sudo sphinx_fe \
     42     -argfile $acoustic_model_dir/feat.params \
     43     -samprate 16000 \
     44     -c $audio_file_dir/$model_name.fileids \
     45     -di . -do . -ei wav -eo mfc -mswav yes #\
     46     # &> /dev/null
     47 
     48 sudo $libdir/bw \
     49     -hmmdir $acoustic_model_dir \
     50     -moddeffn $acoustic_model_dir/mdef.txt  \
     51     -ts2cbfn .ptm. -feat 1s_c_d_dd -svspec 0-12/13-25/26-38 \
     52     -cmn current -agc none -dictfn $dict  \
     53     -ctlfn $audio_file_dir/$model_name.fileids \
     54     -lsnfn $audio_file_dir/$model_name.transcription \
     55     -accumdir . #\
     56     # &> /dev/null
     57 
     58 sudo $libdir/mllr_solve \
     59     -meanfn $acoustic_model_dir/means  \
     60     -varfn $acoustic_model_dir/variances \
     61     -outmllrfn mllr_matrix -accumdir . #&> /dev/null
     62 
     63 sudo $libdir/map_adapt \
     64     -moddeffn $acoustic_model_dir/mdef.txt \
     65     -ts2cbfn .ptm. \
     66     -meanfn $acoustic_model_dir/means \
     67     -varfn $acoustic_model_dir/variances \
     68     -mixwfn $acoustic_model_dir/mixture_weights \
     69     -tmatfn $acoustic_model_dir/transition_matrices \
     70     -accumdir . \
     71     -mapmeanfn $acoustic_model_dir/means \
     72     -mapvarfn $acoustic_model_dir/variances \
     73     -mapmixwfn $acoustic_model_dir/mixture_weights \
     74     -maptmatfn $acoustic_model_dir/transition_matrices #\
     75     # &> /dev/null
     76 
     77 sudo $libdir/mk_s2sendump \
     78     -pocketsphinx yes \
     79     -moddeffn $acoustic_model_dir/mdef.txt \
     80     -mixwfn $acoustic_model_dir/mixture_weights \
     81     -sendumpfn $acoustic_model_dir/sendump #\
     82     # &> /dev/null