29 using namespace kaldi;
31 "Apply Kaldi pitch extractor and pitch post-processor, starting from wav input.\n" 32 "Equivalent to compute-kaldi-pitch-feats | process-kaldi-pitch-feats, except\n" 33 "that it is able to simulate online pitch extraction; see options like\n" 34 "--frames-per-chunk, --simulate-first-pass-online, --recompute-frame.\n" 36 "Usage: compute-and-process-kaldi-pitch-feats [options...] <wav-rspecifier> <feats-wspecifier>\n" 38 "compute-and-process-kaldi-pitch-feats --simulate-first-pass-online=true \\\n" 39 " --frames-per-chunk=10 --sample-frequency=8000 scp:wav.scp ark:- \n" 40 "See also: compute-kaldi-pitch-feats, process-kaldi-pitch-feats\n";
56 if (po.NumArgs() != 2) {
61 std::string wav_rspecifier = po.GetArg(1),
62 feat_wspecifier = po.GetArg(2);
67 int32 num_done = 0, num_err = 0;
68 for (; !wav_reader.Done(); wav_reader.Next()) {
69 std::string utt = wav_reader.Key();
70 const WaveData &wave_data = wav_reader.Value();
79 KALDI_WARN <<
"Channel not specified but you have data with " 80 << num_chan <<
" channels; defaulting to zero";
82 if (this_chan >= num_chan) {
83 KALDI_WARN <<
"File with id " << utt <<
" has " 84 << num_chan <<
" channels but you specified channel " 85 << channel <<
", producing no output.";
92 KALDI_ERR <<
"Sample frequency mismatch: you specified " 93 << pitch_opts.
samp_freq <<
" but data has " 94 << wave_data.
SampFreq() <<
" (use --sample-frequency option)";
101 waveform, &features);
103 KALDI_WARN <<
"Failed to compute pitch for utterance " 109 feat_writer.Write(utt, features);
110 if (num_done % 50 == 0 && num_done != 0)
111 KALDI_VLOG(2) <<
"Processed " << num_done <<
" utterances";
114 KALDI_LOG <<
"Done " << num_done <<
" utterances, " << num_err
116 return (num_done != 0 ? 0 : 1);
117 }
catch(
const std::exception &e) {
118 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
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...
void ComputeAndProcessKaldiPitch(const PitchExtractionOptions &pitch_opts, const ProcessPitchOptions &process_opts, const VectorBase< BaseFloat > &wave, Matrix< BaseFloat > *output)
This function combines ComputeKaldiPitch and ProcessPitch.
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...
void Register(ParseOptions *opts)