Fangjun Kuang
Committed by GitHub

Use high_freq -400 in computing fbank features. (#515)

Fixes #514
@@ -46,6 +46,12 @@ class FeatureExtractor::Impl { @@ -46,6 +46,12 @@ class FeatureExtractor::Impl {
46 46
47 opts_.mel_opts.num_bins = config.feature_dim; 47 opts_.mel_opts.num_bins = config.feature_dim;
48 48
  49 + // Please see
  50 + // https://github.com/lhotse-speech/lhotse/blob/master/lhotse/features/fbank.py#L27
  51 + // and
  52 + // https://github.com/k2-fsa/sherpa-onnx/issues/514
  53 + opts_.mel_opts.high_freq = -400;
  54 +
49 fbank_ = std::make_unique<knf::OnlineFbank>(opts_); 55 fbank_ = std::make_unique<knf::OnlineFbank>(opts_);
50 } 56 }
51 57
@@ -83,6 +83,12 @@ class OfflineStream::Impl { @@ -83,6 +83,12 @@ class OfflineStream::Impl {
83 opts_.frame_opts.samp_freq = config.sampling_rate; 83 opts_.frame_opts.samp_freq = config.sampling_rate;
84 opts_.mel_opts.num_bins = config.feature_dim; 84 opts_.mel_opts.num_bins = config.feature_dim;
85 85
  86 + // Please see
  87 + // https://github.com/lhotse-speech/lhotse/blob/master/lhotse/features/fbank.py#L27
  88 + // and
  89 + // https://github.com/k2-fsa/sherpa-onnx/issues/514
  90 + opts_.mel_opts.high_freq = -400;
  91 +
86 fbank_ = std::make_unique<knf::OnlineFbank>(opts_); 92 fbank_ = std::make_unique<knf::OnlineFbank>(opts_);
87 } 93 }
88 94