Skip to content

Commit

Permalink
[src] Add GetSamplingFrequency() to class FeaturePipelineInfo (#3939)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovbraun committed Mar 3, 2020
1 parent 194f674 commit beb1c4b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/online2/online-nnet2-feature-pipeline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -241,5 +241,17 @@ BaseFloat OnlineNnet2FeaturePipelineInfo::FrameShiftInSeconds() const {
}
}

BaseFloat OnlineNnet2FeaturePipelineInfo::GetSamplingFrequency() {
if (feature_type == "mfcc") {
return mfcc_opts.frame_opts.samp_freq;
} else if (feature_type == "plp") {
return plp_opts.frame_opts.samp_freq;
} else if (feature_type == "fbank") {
return fbank_opts.frame_opts.samp_freq;
} else {
KALDI_ERR << "Unknown feature type " << feature_type;
}
return 0.0f; // avoiding a possible "return missing" warning
}

} // namespace kaldi
3 changes: 3 additions & 0 deletions src/online2/online-nnet2-feature-pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ struct OnlineNnet2FeaturePipelineInfo {
/// on the command line instead of inside sub-config-files.
OnlineSilenceWeightingConfig silence_weighting_config;

/// Returns the frequency expected by the model
BaseFloat GetSamplingFrequency();

int32 IvectorDim() { return ivector_extractor_info.extractor.IvectorDim(); }
private:
KALDI_DISALLOW_COPY_AND_ASSIGN(OnlineNnet2FeaturePipelineInfo);
Expand Down

0 comments on commit beb1c4b

Please sign in to comment.