21 #ifndef KALDI_FEAT_FEATURE_WINDOW_H_ 22 #define KALDI_FEAT_FEATURE_WINDOW_H_ 56 frame_length_ms(25.0),
59 remove_dc_offset(true),
61 round_to_power_of_two(true),
64 allow_downsample(false),
65 allow_upsample(false),
66 max_feature_vectors(-1)
70 opts->
Register(
"sample-frequency", &samp_freq,
71 "Waveform data sample frequency (must match the waveform file, " 72 "if specified there)");
73 opts->
Register(
"frame-length", &frame_length_ms,
"Frame length in milliseconds");
74 opts->
Register(
"frame-shift", &frame_shift_ms,
"Frame shift in milliseconds");
75 opts->
Register(
"preemphasis-coefficient", &preemph_coeff,
76 "Coefficient for use in signal preemphasis");
77 opts->
Register(
"remove-dc-offset", &remove_dc_offset,
78 "Subtract mean from waveform on each frame");
79 opts->
Register(
"dither", &dither,
"Dithering constant (0.0 means no dither). " 80 "If you turn this off, you should set the --energy-floor " 81 "option, e.g. to 1.0 or 0.1");
82 opts->
Register(
"window-type", &window_type,
"Type of window " 83 "(\"hamming\"|\"hanning\"|\"povey\"|\"rectangular\"" 84 "|\"sine\"|\"blackmann\")");
85 opts->
Register(
"blackman-coeff", &blackman_coeff,
86 "Constant coefficient for generalized Blackman window.");
87 opts->
Register(
"round-to-power-of-two", &round_to_power_of_two,
88 "If true, round window size to power of two by zero-padding " 90 opts->
Register(
"snip-edges", &snip_edges,
91 "If true, end effects will be handled by outputting only frames that " 92 "completely fit in the file, and the number of frames depends on the " 93 "frame-length. If false, the number of frames depends only on the " 94 "frame-shift, and we reflect the data at the ends.");
95 opts->
Register(
"allow-downsample", &allow_downsample,
96 "If true, allow the input waveform to have a higher frequency than " 97 "the specified --sample-frequency (and we'll downsample).");
98 opts->
Register(
"max-feature-vectors", &max_feature_vectors,
99 "Memory optimization. If larger than 0, periodically remove feature " 100 "vectors so that only this number of the latest feature vectors is " 102 opts->
Register(
"allow-upsample", &allow_upsample,
103 "If true, allow the input waveform to have a lower frequency than " 104 "the specified --sample-frequency (and we'll upsample).");
123 window(other.window) { }
183 BaseFloat *log_energy_pre_window = NULL);
216 BaseFloat *log_energy_pre_window = NULL);
223 #endif // KALDI_FEAT_FEATURE_WINDOW_H_ This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Vector< BaseFloat > window
int32 RoundUpToNearestPowerOfTwo(int32 n)
virtual void Register(const std::string &name, bool *ptr, const std::string &doc)=0
void ExtractWindow(int64 sample_offset, const VectorBase< BaseFloat > &wave, int32 f, const FrameExtractionOptions &opts, const FeatureWindowFunction &window_function, Vector< BaseFloat > *window, BaseFloat *log_energy_pre_window)
int64 FirstSampleOfFrame(int32 frame, const FrameExtractionOptions &opts)
int32 NumFrames(int64 num_samples, const FrameExtractionOptions &opts, bool flush)
This function returns the number of frames that we can extract from a wave file with the given number...
void ProcessWindow(const FrameExtractionOptions &opts, const FeatureWindowFunction &window_function, VectorBase< BaseFloat > *window, BaseFloat *log_energy_pre_window)
This function does all the windowing steps after actually extracting the windowed signal: depending o...
void Preemphasize(VectorBase< BaseFloat > *waveform, BaseFloat preemph_coeff)
A class representing a vector.
Provides a vector abstraction class.
void Dither(VectorBase< BaseFloat > *waveform, BaseFloat dither_value)
FeatureWindowFunction(const FeatureWindowFunction &other)