NAME

genfeature.tcl - Feature computation script.


AVAILABILITY

script/hmm_1.0


SYNOPSIS

genfeature.tcl mlffile [options]


PARAMETERS

mlffile
Input master transcription file.

OPTIONS

-type string [Default = MFCC]
Specify the type of signal processing to perform. (MFCC/PLP/LPC)
-preemphasis float [Default = 0.98]
Signal preemphasis filter value.
-framesize float [Default = 10.0ms]
Analysis frame increment in milliseconds.
-windowsize float [Default = 16.0ms]
Analysis window size in milliseconds.
-samplerate int [Default = 8000]
Sample rate in Hz of input waveform.
-order int [Default = 0(none)]
Model order when all pole modeling is used.
-features int [Default = 13]
Number of output cepstral coefficients.
-filters int [Default = 21]
Number of filters used in frequency scale (MEL or Bark).
-exponent float [Default = 0.6]
Exponential liftering factor.
-script string [Default = none]
A user supplied feature processing script. Specifies an alternative method for processing feature. The user script must override the default GenFeature function (see example below).
-basedir string [Default = /u0/tmp]
The directory name where feature files are stored.
-config string [Default = none]
Read command line options (configuration info) from this file. The configuration file is in essence a Tcl script which sets the required internal variables.
 set config(feature,exponent)    0.6
 set config(feature,features)    13
 set config(feature,filters)     21
 set config(feature,framesize)   10.0
 set config(feature,windowsize)  16.0
 set config(feature,order)       0
 set config(feature,preemphasis) 0.98
 set config(feature,samplerate)  8000
 set config(feature,type)        MFCC
 set config(feature,basedir)     /u0/tmp

These values will override the preset default settings. Subsequent command line options will override the values specified by the configuration script. Command line parameters are specified using the param variable.

 set param(feature,mlffile)     foo

Since command line parameters are typically not optional the user needs to specify the command line parameters as a single "-" character for the settings defined in the configuration script to take effect.

-help
List command line options and defaults.

DESCRIPTION

The genfeature.tcl script is used to extract the baseline features for training HMM models. Currently only MFCC/LPC/PLP coefficients are supported. However, the script can easily be modified to include the other processing functions supported by the analysis package.

The default processing may be overrided using the -script switch to specify the user specific code (script). This script must override a function similar to the default GenFeature function. GenFeature accepts as input a string containing the speech waveform filename, the cache name (cdid) and a unique field identifier. The following are the main fields which should be supported. These fields are specified using the Tcl "array set" function.

The user specific script is also used to define the feature post-processing. When features are loaded for HMM training, only the base features as saved in the feature cache are used. If further post-processing is required such as adding the first and second order time derivatives the user needs to specify the feature processing script via the configuration file. The variable config(feature,script) is used for this purpose. The user script needs to provide a function called UserFeat which is called by the main ComputeFeature function. The code below shows an example of such a user defined post-processing function.


EXAMPLE

The following example function shows how one can override the default computation to do Fourier analysis.

 package require Analysis
 package require Mx
 package require Rtcl
 package require Wave
 proc GenFeature labelfile {
  global cacheFile 
  array set info [lindex $labelfile 0]
  set cdid     $info(cdid)
  set filename $info(filename)
  if [info exists info(key)] { set key $info(key) } { set key $filename }
 
  # read wave and compute feature
  if ![info exists cacheFile($cdid)] {
   set cacheFile($cdid) [obfile open /tmp/$cdid w]
  }
  if [catch {set wfeat [obfile read $cacheFile($cdid) $key]}] {
   puts stderr $filename
   set w  [wave read $filename]
   set fft [analysis realfft initialize]
   set wfft [analysis realff $fft $w]
   set wspec [analysis pspec $fft $wfft]
   obfile write $cacheFile($cdid) $key $wfeat
   nuke $w $fft $wfft
  }
  nuke $wfeat
 }
 # user post-processing function
 proc UserFeat wmf {
 
  # cepstral mean subtraction
  set mf [mx zeromean $wmf]
  nuke $wmf
 
  # delta
  set dd  [analysis delta initialize -order 2 -sigmaT2 13]
  set mld [analysis delta $dd $mf -flush]; nuke $dd;
  lappend mf [set mlc [mx cut $mld :,0:12]]; nuke $mld
 
  # delta^2
  set dd  [analysis delta initialize -order 2 -sigmaT2 13]
  set mld [analysis delta $dd $mlc -flush]; nuke $dd;
  lappend mf [mx cut $mld :,0:12]; nuke $mld
  set wfeat [mx join col $mf]
  nuke $mf
 
  return $wfeat
 }

SEE ALSO

hmminit.tcl, hmmtrain.tcl, hmmembed.tcl, hmmscribe.tcl, hmmsearch.tcl, Master Label File


AUTHOR

Johan Schalkwyk
Center for Spoken Language Understanding
Oregon Graduate Institute of Science & Technology


Last modified on Wed Mar 11 11:10:53 PST 1998.