‹ projects

vmc

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

acousticfiles.sh (1649B)


      1 #!/bin/bash
      2 # 
      3 # DESCRIPTION -----------------------------------------------------------------
      4 # 
      5 #       Produce acoustic feature files from user-supplied voice recordings. 
      6 #       These are stored with the associated audio files, and named similarly 
      7 #       with an .mfc extension.
      8 #
      9 #       Do not include trailing forward slashes in the folder paths.
     10 # 
     11 # USAGE | EXAMPLE -------------------------------------------------------------
     12 #   bash acousticfiles.sh /path/to/audio/folder \
     13 #                         /path/to/acoustic/model \
     14 #                         /path/to/model.fileids
     15 #
     16 # VARIABLE DEFINITIONS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     17 
     18 audio_folder_path="$1"          # e.g. ~/.psyche/audio
     19 
     20 # i.e. /usr/local/lib/python2.7/dist-packages/pocketsphinx/model/en-us
     21 acoustic_model_location="$2"
     22 
     23 fileids_location="$3"           # e.g. ~/.psyche/audio/model.fileids
     24 
     25 # FUNCTION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     26 
     27 # generate some acoustic feature files - if supplementing an existing audio 
     28 # collection, this will overwrite the preexisting feature files.  There isn't a
     29 # way around that without either ugly hacks or a rewrite of the sphinx_fe file.
     30 
     31 echo "Generating acoustic feature files..."
     32 cd $audio_folder_path  # sphinx_fe likes to have a consistent working directory
     33 sudo sphinx_fe -argfile \
     34                "$acoustic_model_location/feat.params" \
     35                -samprate 16000 \
     36                -c $fileids_location \
     37                -di . \
     38                -do . \
     39                -ei wav \
     40                -eo mfc \
     41                -mswav yes \
     42                &> /dev/null