kaldi-native-fbank C++ API
Kaldi-compatible feature extraction C++ API
Loading...
Searching...
No Matches
knf::FeatureWindowFunction Class Reference

Stores the windowing coefficients and applies them to a frame. More...

#include <feature-window.h>

Public Member Functions

 FeatureWindowFunction ()=default
 Construct an empty window function.
 FeatureWindowFunction (const FrameExtractionOptions &opts)
 Construct the windowing function implied by opts.window_type, with a size of opts.WindowSize().
 FeatureWindowFunction (const std::string &window_type, int32_t window_size, float blackman_coeff=0.42)
 Construct the windowing function of the given type and size.
 FeatureWindowFunction (const std::vector< float > &window)
 Construct from explicit window coefficients.
void Apply (float *wave) const
 Apply the window to a frame, in place.
const std::vector< float > & GetWindow () const
 Return the window coefficients.

Detailed Description

Stores the windowing coefficients and applies them to a frame.

The window type is specified either by a FrameExtractionOptions, by a window-type name plus a window size, or directly by the coefficients.

Used by:
ExtractWindow(), ProcessWindow(), Stft/IStft, and OnlineGenericBaseFeature (online-feature.h).
See also
GetWindow, FrameExtractionOptions, ProcessWindow

Constructor & Destructor Documentation

◆ FeatureWindowFunction() [1/4]

knf::FeatureWindowFunction::FeatureWindowFunction ( )
default

Construct an empty window function.

You must assign a real window to it before calling Apply().

◆ FeatureWindowFunction() [2/4]

knf::FeatureWindowFunction::FeatureWindowFunction ( const FrameExtractionOptions & opts)
explicit

Construct the windowing function implied by opts.window_type, with a size of opts.WindowSize().

◆ FeatureWindowFunction() [3/4]

knf::FeatureWindowFunction::FeatureWindowFunction ( const std::string & window_type,
int32_t window_size,
float blackman_coeff = 0.42 )

Construct the windowing function of the given type and size.

See GetWindow() for the formula of each window type.

Parameters
window_typeOne of "hamming", "rectangular", "povey", "hanning", "hann", "sine", "blackman".
window_sizeNumber of samples in the window.
blackman_coeffConstant coefficient for generalized Blackman window; only used if window_type is "blackman".

◆ FeatureWindowFunction() [4/4]

knf::FeatureWindowFunction::FeatureWindowFunction ( const std::vector< float > & window)
explicit

Construct from explicit window coefficients.

Member Function Documentation

◆ Apply()

void knf::FeatureWindowFunction::Apply ( float * wave) const

Apply the window to a frame, in place.

Parameters
wavePointer to a 1-D array of shape [window_size]. It is modified in-place: wave[i] = wave[i] * window_[i].

◆ GetWindow()

const std::vector< float > & knf::FeatureWindowFunction::GetWindow ( ) const
inline

Return the window coefficients.


The documentation for this class was generated from the following file:
  • /home/runner/work/kaldi-native-fbank/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-window.h