diff --git a/src/online2/online-nnet2-feature-pipeline.cc b/src/online2/online-nnet2-feature-pipeline.cc index b291ba92d98..67f42754db4 100644 --- a/src/online2/online-nnet2-feature-pipeline.cc +++ b/src/online2/online-nnet2-feature-pipeline.cc @@ -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 diff --git a/src/online2/online-nnet2-feature-pipeline.h b/src/online2/online-nnet2-feature-pipeline.h index 6275378823a..3e4be736416 100644 --- a/src/online2/online-nnet2-feature-pipeline.h +++ b/src/online2/online-nnet2-feature-pipeline.h @@ -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);