‹ projects

vmc

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

commit d2c11c31ca8e87ac22d9a3d89ba2b62ddae10c1c
parent 518ba722cfe2c2538b1f02b7c7c9227adf0da146
Author: umhau <umhau@alum.gcc.edu>
Date:   Thu, 15 Jun 2017 12:27:55 -0400

made clearer and reflective of better algorithm organization.

Diffstat:
Mlib/voicemodel.sh | 143+++++++++++++++++++++++++++++++++++--------------------------------------------
1 file changed, 63 insertions(+), 80 deletions(-)

diff --git a/lib/voicemodel.sh b/lib/voicemodel.sh @@ -1,98 +1,82 @@ #!/bin/bash # -# DESCRIPTION +# DESCRIPTION ================================================================= # -# Given acoustic feature files and sentence file derivatives, produce voice model. -# -# USAGE -# -# bash voicemodel.sh model-name model-dir acoustic-files-dir sentence-file-derivatives-dir -# -# EXAMPLE -# -# bash voicemodel.sh new_model ~/tools/new_model ~/tools/new_model/audio ~/tools/new_model +# Given acoustic feature files and sentence file derivatives, produce +# voice model. # -# DEPENDENCIES -# -# CMU Sphinx +# This script is primarily using a copy of en-us that is being actively +# edited as it is adapted to become a custom voice model. # -# NOTES +# Binaries are located in /opt/vmc/lib. # -# This script is primarily using a copy of en-us that is being actively edited as it is -# adapted to become a custom voice model. +# USAGE EXAMPLE =============================================================== # -# Binaries are located in /opt/vmc/tools. +# bash voicemodel.sh \ +# 'en-us' \ +# /usr/local/lib/python2.7/dist-packages/pocketsphinx/model/en-us \ +# ~/.psyche/audio # -# VARIABLES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# VARIABLES =================================================================== -model_name=$1 -model_dir=$2 # location of adapted voice model files: copy of en-us, audio files, etc. -af_dir=$3 # directory containing audio files and audio feature files -sf_dir=$4 # directory containing sentence file derivatives +model_name=$1 # If performing adaptation, this must match prior names. +acoustic_model_dir=$2 # 'en-us' default voice model folder +audio_file_dir=$3 # contains audio file and sentence file derivatives -tools_dir=/opt/vmc/tools +libdir=/opt/vmc/lib -pronunciation_dictionary=$tools_dir/cmudict-en-us.dict +# also located at /opt/vmc/lib/cmudict-en-us.dict +dict="/usr/local/lib/python2.7/dist-packages/pocketsphinx/model/cmudict-en-us.dict" -# COMMANDS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# COMMANDS ==================================================================== -# convert binary mdef file to .txt -cd $model_dir -pocketsphinx_mdef_convert -text $model_dir/en-us/mdef $model_dir/en-us/mdef.txt &> /dev/null +# convert binary mdef file to .txt -------------------------------------------- +cd $acoustic_model_dir +sudo pocketsphinx_mdef_convert \ + -text $acoustic_model_dir/mdef $acoustic_model_dir/mdef.txt &> /dev/null -# run tools to create voice model -cd $af_dir +# run tools to create voice model --------------------------------------------- +cd $audio_file_dir -# sphinx_fe -sphinx_fe \ - -argfile $model_dir/en-us/feat.params \ - -samprate 16000 \ - -c $sf_dir/$model_name.fileids \ - -di . \ - -do . \ - -ei wav \ - -eo mfc \ - -mswav yes \ - &> /dev/null +sudo sphinx_fe \ + -argfile $acoustic_model_dir/feat.params \ + -samprate 16000 \ + c $audio_file_dir/$model_name.fileids \ + -di . -do . -ei wav -eo mfc -mswav yes \ + &> /dev/null -$tools_dir/bw \ - -hmmdir $model_dir/en-us \ - -moddeffn $model_dir/en-us/mdef.txt \ - -ts2cbfn .ptm. \ - -feat 1s_c_d_dd \ - -svspec 0-12/13-25/26-38 \ - -cmn current \ - -agc none \ - -dictfn $pronunciation_dictionary \ - -ctlfn $sf_dir/$model_name.fileids \ - -lsnfn $sf_dir/$model_name.transcription \ - -accumdir . \ - &> /dev/null +sudo $libdir/bw \ + -hmmdir $acoustic_model_dir \ + -moddeffn $acoustic_model_dir/mdef.txt \ + -ts2cbfn .ptm. -feat 1s_c_d_dd -svspec 0-12/13-25/26-38 \ + -cmn current -agc none -dictfn $dict \ + -ctlfn $audio_file_dir/$model_name.fileids \ + -lsnfn $audio_file_dir/$model_name.transcription \ + -accumdir . \ + &> /dev/null -$tools_dir/mllr_solve \ - -meanfn $model_dir/en-us/means \ - -varfn $model_dir/en-us/variances \ - -outmllrfn mllr_matrix \ - -accumdir . \ - &> /dev/null +sudo $libdir/mllr_solve \ + -meanfn $acoustic_model_dir/means \ + -varfn $acoustic_model_dir/variances \ + -outmllrfn mllr_matrix -accumdir . &> /dev/null -$tools_dir/map_adapt \ - -moddeffn $model_dir/en-us/mdef.txt \ - -ts2cbfn .ptm. \ - -meanfn $model_dir/en-us/means \ - -varfn $model_dir/en-us/variances \ - -mixwfn $model_dir/en-us/mixture_weights \ - -tmatfn $model_dir/en-us/transition_matrices \ - -accumdir . \ - -mapmeanfn $model_dir/en-us/means \ - -mapvarfn $model_dir/en-us/variances \ - -mapmixwfn $model_dir/en-us/mixture_weights \ - -maptmatfn $model_dir/en-us/transition_matrices\ - &> /dev/null +sudo $libdir/map_adapt \ + -moddeffn $acoustic_model_dir/mdef.txt \ + -ts2cbfn .ptm. \ + -meanfn $acoustic_model_dir/means \ + -varfn $acoustic_model_dir/variances \ + -mixwfn $acoustic_model_dir/mixture_weights \ + -tmatfn $acoustic_model_dir/transition_matrices \ + -accumdir . \ + -mapmeanfn $acoustic_model_dir/means \ + -mapvarfn $acoustic_model_dir/variances \ + -mapmixwfn $acoustic_model_dir/mixture_weights \ + -maptmatfn $acoustic_model_dir/transition_matrices\ + &> /dev/null -$tools_dir/mk_s2sendump \ - -pocketsphinx yes \ - -moddeffn $model_dir/en-us/mdef.txt \ - -mixwfn $model_dir/en-us/mixture_weights \ - -sendumpfn $model_dir/en-us/sendump \ - &> /dev/null -\ No newline at end of file +sudo $libdir/mk_s2sendump \ + -pocketsphinx yes \ + -moddeffn $acoustic_model_dir/mdef.txt \ + -mixwfn $acoustic_model_dir/mixture_weights \ + -sendumpfn $acoustic_model_dir/sendump \ + &> /dev/null