29 using namespace kaldi;
31 "Apply Kaldi pitch extractor, starting from wav input. Output is 2-dimensional\n" 32 "features consisting of (NCCF, pitch in Hz), where NCCF is between -1 and 1, and\n" 33 "higher for voiced frames. You will typically pipe this into\n" 34 "process-kaldi-pitch-feats.\n" 35 "Usage: compute-kaldi-pitch-feats [options...] <wav-rspecifier> <feats-wspecifier>\n" 37 "compute-kaldi-pitch-feats --sample-frequency=8000 scp:wav.scp ark:- \n" 39 "See also: process-kaldi-pitch-feats, compute-and-process-kaldi-pitch-feats\n";
52 if (po.NumArgs() != 2) {
57 std::string wav_rspecifier = po.GetArg(1),
58 feat_wspecifier = po.GetArg(2);
63 int32 num_done = 0, num_err = 0;
64 for (; !wav_reader.Done(); wav_reader.Next()) {
65 std::string utt = wav_reader.Key();
66 const WaveData &wave_data = wav_reader.Value();
75 KALDI_WARN <<
"Channel not specified but you have data with " 76 << num_chan <<
" channels; defaulting to zero";
78 if (this_chan >= num_chan) {
79 KALDI_WARN <<
"File with id " << utt <<
" has " 80 << num_chan <<
" channels but you specified channel " 81 << channel <<
", producing no output.";
88 KALDI_ERR <<
"Sample frequency mismatch: you specified " 89 << pitch_opts.
samp_freq <<
" but data has " 90 << wave_data.
SampFreq() <<
" (use --sample-frequency " 91 <<
"option). Utterance is " << utt;
99 KALDI_WARN <<
"Failed to compute pitch for utterance " 105 feat_writer.Write(utt, features);
106 if (num_done % 50 == 0 && num_done != 0)
107 KALDI_VLOG(2) <<
"Processed " << num_done <<
" utterances";
110 KALDI_LOG <<
"Done " << num_done <<
" utterances, " << num_err
112 return (num_done != 0 ? 0 : 1);
113 }
catch(
const std::exception &e) {
114 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void ComputeKaldiPitch(const PitchExtractionOptions &opts, const VectorBase< BaseFloat > &wave, Matrix< BaseFloat > *output)
This function extracts (pitch, NCCF) per frame, using the pitch extraction method described in "A Pit...
A templated class for writing objects to an archive or script file; see The Table concept...
BaseFloat SampFreq() const
const Matrix< BaseFloat > & Data() 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...
This class's purpose is to read in Wave files.
#define KALDI_ASSERT(cond)
MatrixIndexT NumRows() const
Returns number of rows (or zero for empty matrix).
Represents a non-allocating general vector which can be defined as a sub-vector of higher-level vecto...