26 int main(
int argc,
char *argv[]) {
28 using namespace kaldi;
32 "Apply sliding-window cepstral mean (and optionally variance)\n" 33 "normalization per utterance. If center == true, window is centered\n" 34 "on frame being normalized; otherwise it precedes it in time.\n" 35 "Useful for speaker-id; see also apply-cmvn-online\n" 37 "Usage: apply-cmvn-sliding [options] <feats-rspecifier> <feats-wspecifier>\n";
50 int32 num_done = 0, num_err = 0;
52 std::string feat_rspecifier = po.
GetArg(1);
53 std::string feat_wspecifier = po.
GetArg(2);
58 for (;!feat_reader.
Done(); feat_reader.
Next()) {
59 std::string utt = feat_reader.
Key();
61 if (feat.NumRows() == 0) {
62 KALDI_WARN <<
"Empty feature matrix for utterance " << utt;
71 feat_writer.
Write(utt, cmvn_feat);
75 KALDI_LOG <<
"Applied sliding-window cepstral mean " 77 <<
"normalization to " << num_done <<
" utterances, " 78 << num_err <<
" had errors.";
79 return (num_done != 0 ? 0 : 1);
80 }
catch(
const std::exception &e) {
81 std::cerr << e.what();
int main(int argc, char *argv[])
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
A templated class for writing objects to an archive or script file; see The Table concept...
void Write(const std::string &key, const T &value) const
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
int Read(int argc, const char *const *argv)
Parses the command line options and fills the ParseOptions-registered variables.
std::string GetArg(int param) const
Returns one of the positional parameters; 1-based indexing for argc/argv compatibility.
void Register(OptionsItf *opts)
int NumArgs() const
Number of positional parameters (c.f. argc-1).
void SlidingWindowCmn(const SlidingWindowCmnOptions &opts, const MatrixBase< BaseFloat > &input, MatrixBase< BaseFloat > *output)
Applies sliding-window cepstral mean and/or variance normalization.