kaldi-native-fbank C++ API
Kaldi-compatible feature extraction C++ API
Loading...
Searching...
No Matches
kaldi-native-fbank C++ API

Kaldi-compatible feature extraction. Headers live in kaldi-native-fbank/csrc/. All computations match kaldi numerically (kaldi uses float/double matrices; this library uses row-major Eigen typedefs MatrixF / MatrixD / VectorF from feature-matrix.h).

Modules

Online (running) CMVN — online-cmvn.h

knf::OnlineCmvn is a port of kaldi's OnlineCmvn (kaldi/src/feat/online-feature.h): cepstral mean (and optional variance) normalization computed only from the past, for streaming use. Unlike the offline CMVN of feature-cmvn.h (whole-utterance stats), it accumulates a sliding window of the previous cmn_window frames (default 600) and normalizes the current frame with them; at the start of an utterance the window is backed off with speaker_frames frames of speaker stats (from previous utterances, see knf::OnlineCmvnState) and global_frames frames of global stats.

The class is push-style: AcceptFeature(frame) returns the normalized frame. Freeze() fixes the normalization (stats stop updating), and GetState() carries the speaker adaptation (and any frozen normalization) to the next utterance of the same speaker.

knf::OnlineCmvnOptions opts; // kaldi defaults
knf::OnlineCmvnState state(global_stats); // MatrixD [2, dim+1]
knf::OnlineCmvn cmvn(opts, state);
for (const knf::VectorF &f : frames) {
knf::VectorF y = cmvn.AcceptFeature(f); // normalized
}
auto next = cmvn.GetState(); // next utterance
Online (running) cepstral mean and optional variance normalization.
Definition online-cmvn.h:130
Eigen::VectorXf VectorF
1-D feature/aux vector (float).
Definition feature-matrix.h:35
Options for OnlineCmvn, mirroring kaldi's OnlineCmvnOptions (kaldi/src/feat/online-feature....
Definition online-cmvn.h:28
State of CMVN adaptation between utterances (not the within-utterance computation state).
Definition online-cmvn.h:73

Options, formulas and the correspondence with kaldi are documented on the struct/class pages (knf::OnlineCmvnOptions, knf::OnlineCmvnState, knf::OnlineCmvn) and in docs/source/python-api/online-cmvn.rst. Parity with kaldi's apply-cmvn-online is tested in tests/parity/parity_online_cmvn.py.

See also the Python API documentation.