Update kaldi-native-fbank. (#2259)

Now it supports FFT of an even number, not necessarily a power of 2.
This commit is contained in:
Fangjun Kuang
2025-05-29 10:34:22 +08:00
committed by GitHub
parent d8b5a58898
commit 8e6826521e
9 changed files with 28 additions and 16 deletions

View File

@@ -197,6 +197,7 @@ class FeatureExtractor::Impl {
opts_.frame_opts.remove_dc_offset = config_.remove_dc_offset;
opts_.frame_opts.preemph_coeff = config_.preemph_coeff;
opts_.frame_opts.window_type = config_.window_type;
opts_.frame_opts.round_to_power_of_two = config_.round_to_power_of_two;
opts_.mel_opts.num_bins = config_.feature_dim;
@@ -216,6 +217,7 @@ class FeatureExtractor::Impl {
mfcc_opts_.frame_opts.remove_dc_offset = config_.remove_dc_offset;
mfcc_opts_.frame_opts.preemph_coeff = config_.preemph_coeff;
mfcc_opts_.frame_opts.window_type = config_.window_type;
mfcc_opts_.frame_opts.round_to_power_of_two = config_.round_to_power_of_two;
mfcc_opts_.mel_opts.num_bins = config_.feature_dim;

View File

@@ -79,6 +79,8 @@ struct FeatureExtractorConfig {
bool is_mfcc = false;
bool round_to_power_of_two = true;
std::string ToString() const;
void Register(ParseOptions *po);

View File

@@ -109,6 +109,12 @@ class OfflineRecognizerCtcImpl : public OfflineRecognizerImpl {
config_.feat_config.preemph_coeff = 0;
config_.feat_config.window_type = "hann";
config_.feat_config.feature_dim = 64;
// see
// https://github.com/salute-developers/GigaAM/blob/main/gigaam/preprocess.py#L68
//
// GigaAM uses n_fft 400
config_.feat_config.round_to_power_of_two = false;
} else {
config_.feat_config.low_freq = 0;
config_.feat_config.high_freq = 0;

View File

@@ -156,6 +156,12 @@ class OfflineRecognizerTransducerNeMoImpl : public OfflineRecognizerImpl {
config_.feat_config.preemph_coeff = 0;
config_.feat_config.window_type = "hann";
config_.feat_config.feature_dim = 64;
// see
// https://github.com/salute-developers/GigaAM/blob/main/gigaam/preprocess.py#L68
//
// GigaAM uses n_fft 400
config_.feat_config.round_to_power_of_two = false;
} else {
config_.feat_config.low_freq = 0;
// config_.feat_config.high_freq = 8000;