47#include <sphinxbase/sphinxbase_export.h>
49#include <sphinxbase/fe.h>
64#define LIVEBUFBLOCKSIZE 256
66#define S3_MAX_FRAMES 15000
68#define cepstral_to_feature_command_line_macro() \
72 "Feature stream type, depends on the acoustic model" }, \
76 "Number of components in the input feature vector" }, \
80 "Cepstral mean normalization scheme ('live', 'batch', or 'none')" }, \
84 "Initial values (comma-separated) for cepstral mean when 'live' is used" }, \
88 "Variance normalize each utterance (only if CMN == current)" }, \
92 "Automatic gain control for c0 ('max', 'emax', 'noise', or 'none')" }, \
96 "Initial threshold for automatic gain control" }, \
100 "File containing transformation matrix to be applied to features (single-stream features only)" }, \
104 "Dimensionality of output of feature transformation (0 to use entire matrix)" }, \
108 "Subvector specification (e.g., 24,0-11/25,12-23/26-38 or 0-12/13-25/26-38)"}
167#define feat_name(f) ((f)->name)
171#define feat_cepsize(f) ((f)->cepsize)
175#define feat_window_size(f) ((f)->window_size)
181#define feat_n_stream(f) ((f)->n_stream)
187#define feat_stream_len(f,i) ((f)->stream_len[i])
191#define feat_dimension1(f) ((f)->n_sv ? (f)->n_sv : f->n_stream)
195#define feat_dimension2(f,i) ((f)->lda ? (f)->out_dim : ((f)->sv_len ? (f)->sv_len[i] : f->stream_len[i]))
199#define feat_dimension(f) ((f)->out_dim)
203#define feat_stream_lengths(f) ((f)->lda ? (&(f)->out_dim) : (f)->sv_len ? (f)->sv_len : f->stream_len)
319 mfcc_t ***inout_feat,
routine that implements automatic gain control
enum agc_type_e agc_type_t
Types of acoustic gain control to apply to the features.
Apply Cepstral Mean Normalization (CMN) to the set of input mfc frames.
enum cmn_type_e cmn_type_t
Types of cepstral mean normalization to apply to the features.
SPHINXBASE_EXPORT void cmn(cmn_t *cmn, mfcc_t **mfc, int32 varnorm, int32 n_frame)
CMN for the whole sentence.
SPHINXBASE_EXPORT mfcc_t *** feat_array_alloc(feat_t *fcb, int32 nfr)
Allocate an array to hold several frames worth of feature vectors.
SPHINXBASE_EXPORT feat_t * feat_init(char const *type, cmn_type_t cmn, int32 varnorm, agc_type_t agc, int32 breport, int32 cepsize)
Initialize feature module to use the selected type of feature stream.
SPHINXBASE_EXPORT void feat_update_stats(feat_t *fcb)
Update the normalization stats, possibly in the end of utterance.
SPHINXBASE_EXPORT int32 ** parse_subvecs(char const *str)
Parse subvector specification string.
SPHINXBASE_EXPORT int32 feat_s2mfc2feat_live(feat_t *fcb, mfcc_t **uttcep, int32 *inout_ncep, int32 beginutt, int32 endutt, mfcc_t ***ofeat)
Feature computation routine for live mode decoder.
SPHINXBASE_EXPORT void feat_lda_transform(feat_t *fcb, mfcc_t ***inout_feat, uint32 nfr)
Transform a block of features using the feature module's LDA transform.
SPHINXBASE_EXPORT int32 feat_read_lda(feat_t *feat, const char *ldafile, int32 dim)
Add an LDA transformation to the feature module from a file.
SPHINXBASE_EXPORT mfcc_t *** feat_array_realloc(feat_t *fcb, mfcc_t ***old_feat, int32 ofr, int32 nfr)
Realloate the array of features.
SPHINXBASE_EXPORT int32 feat_s2mfc2feat(feat_t *fcb, const char *file, const char *dir, const char *cepext, int32 sf, int32 ef, mfcc_t ***feat, int32 maxfr)
Read a specified MFC file (or given segment within it), perform CMN/AGC as indicated by fcb,...
SPHINXBASE_EXPORT int feat_free(feat_t *f)
Release resource associated with feat_t.
SPHINXBASE_EXPORT int feat_set_subvecs(feat_t *fcb, int32 **subvecs)
Add a subvector specification to the feature module.
SPHINXBASE_EXPORT void subvecs_free(int32 **subvecs)
Free array of subvector specs.
SPHINXBASE_EXPORT void feat_array_free(mfcc_t ***feat)
Free a buffer allocated with feat_array_alloc()
SPHINXBASE_EXPORT void feat_report(feat_t *f)
Report the feat_t data structure.
SPHINXBASE_EXPORT feat_t * feat_retain(feat_t *f)
Retain ownership of feat_t.
SPHINXBASE_EXPORT void feat_print(feat_t *fcb, mfcc_t ***feat, int32 nfr, FILE *fp)
Print the given block of feature vectors to the given FILE.
Basic type definitions used in Sphinx.
Structure holding data for doing AGC.
wrapper of operation of the cepstral mean normalization.
int32 window_size
Number of extra frames around given input frame needed to compute corresponding output feature (so to...
int32 ** subvecs
Subvector specification (or NULL for none)
mfcc_t ** tmpcepbuf
Array of pointers into cepbuf to handle border cases.
uint32 n_lda
Number of linear transformations in lda.
mfcc_t *** lda
Array of linear transformations (for LDA, MLLT, or whatever)
agc_t * agc_struct
Structure that stores the temporary variables for acoustic gain control.
int32 sv_dim
Total dimensionality of subvector (length of sv_buf)
cmn_type_t cmn
Type of CMN to be performed on each utterance.
agc_type_t agc
Type of AGC to be performed on each utterance.
int32 n_stream
Number of feature streams; e.g., 4 in Sphinx-II.
int refcount
Reference count.
uint32 * stream_len
Vector length of each feature stream.
int32 varnorm
Whether variance normalization is to be performed on each utt; Irrelevant if no CMN is performed.
mfcc_t ** cepbuf
Circular buffer of MFCC frames for live feature computation.
int32 bufpos
Write index in cepbuf.
void(* compute_feat)(struct feat_s *fcb, mfcc_t **input, mfcc_t **feat)
Feature computation function.
char * name
Printable name for this feature type.
uint32 out_dim
Output dimensionality.
uint32 * sv_len
Vector length of each subvector.
int32 curpos
Read index in cepbuf.
int32 cepsize
Size of input speech vector (typically, a cepstrum vector)
cmn_t * cmn_struct
Structure that stores the temporary variables for cepstral means normalization.
mfcc_t * sv_buf
Temporary copy buffer for subvector projection.
int32 n_sv
Number of subvectors.
Structure for describing a speech feature type Structure for describing a speech feature type (no.