34                                int32 samp_rate_out_hz,
    37     samp_rate_in_(samp_rate_in_hz),
    38     samp_rate_out_(samp_rate_out_hz),
    39     filter_cutoff_(filter_cutoff_hz),
    40     num_zeros_(num_zeros) {
    42                samp_rate_out_hz > 0.0 &&
    43                filter_cutoff_hz > 0.0 &&
    44                filter_cutoff_hz*2 <= samp_rate_in_hz &&
    45                filter_cutoff_hz*2 <= samp_rate_out_hz &&
    68   int64 interval_length_in_ticks = input_num_samp * ticks_per_input_period;
    79     int32 window_width_ticks = floor(window_width * tick_freq);
    84     interval_length_in_ticks -= window_width_ticks;
    86   if (interval_length_in_ticks <= 0)
    93   int64 last_output_samp = interval_length_in_ticks / ticks_per_output_period;
    96   if (last_output_samp * ticks_per_output_period == interval_length_in_ticks)
   100   int64 num_output_samp = last_output_samp + 1;
   101   return num_output_samp;
   112     double min_t = output_t - window_width, max_t = output_t + window_width;
   121         max_input_index = floor(max_t * samp_rate_in_),
   122         num_indices = max_input_index - min_input_index + 1;
   125     for (
int32 j = 0; 
j < num_indices; 
j++) {
   126       int32 input_index = min_input_index + 
j;
   127       double input_t = input_index / 
static_cast<double>(
samp_rate_in_),
   128           delta_t = input_t - output_t;
   138                                 int64 *first_samp_in,
   139                                 int32 *samp_out_wrapped)
 const {
   145   *samp_out_wrapped = 
static_cast<int32>(samp_out -
   166        samp_out < tot_output_samp;
   169     int32 samp_out_wrapped;
   170     GetIndexes(samp_out, &first_samp_in, &samp_out_wrapped);
   174     int32 first_input_index = 
static_cast<int32>(first_samp_in -
   177     if (first_input_index >= 0 &&
   178         first_input_index + weights.
Dim() <= input_dim) {
   180       this_output = 
VecVec(input_part, weights);
   185         int32 input_index = first_input_index + 
i;
   187           this_output += weight *
   189         } 
else if (input_index >= 0 && input_index < input_dim) {
   190           this_output += weight * input(input_index);
   191         } 
else if (input_index >= input_dim) {
   200     (*output)(output_index) = this_output;
   225     int32 input_index = index + input.
Dim();
   226     if (input_index >= 0)
   228     else if (input_index + old_remainder.
Dim() >= 0)
   230           old_remainder(input_index + old_remainder.
Dim());
   258   return filter * window;
   266     num_samples_in_(num_samples_in),
   270   KALDI_ASSERT(num_samples_in > 0 && samp_rate_in > 0.0 &&
   271                filter_cutoff > 0.0 &&
   272                filter_cutoff * 2.0 <= samp_rate_in
   295     output_col.AddMatVec(1.0, input_part,
   307   for (
int32 i = 0; 
i < output_dim; 
i++) {
   314   int32 num_samples = sample_points.
Dim();
   318   for (
int32  i = 0; 
i < num_samples; 
i++) {
   321         t_min = t - filter_width, t_max = t + filter_width;
   331     weights_[
i].Resize(index_max - index_min + 1);
   337   for (
int32 i = 0; 
i < num_samples_out; 
i++) {
   365   return filter * window;
   370   BaseFloat min_freq = std::min(orig_freq, new_freq);
   371   BaseFloat lowpass_cutoff = 0.99 * 0.5 * min_freq;
   372   int32 lowpass_filter_width = 6;
   374                            lowpass_cutoff, lowpass_filter_width);
   375   resampler.
Resample(wave, 
true, new_wave);
 BaseFloat FilterFunc(BaseFloat) const
Here, t is a time in seconds representing an offset from the center of the windowed filter function...
 
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
void Resample(const VectorBase< BaseFloat > &input, bool flush, Vector< BaseFloat > *output)
This function does the resampling. 
 
void CopyColFromVec(const VectorBase< Real > &v, const MatrixIndexT col)
Copy vector into specific column of matrix. 
 
int64 output_sample_offset_
The number of samples we have already output for this signal. 
 
void Reset()
Calling the function Reset() resets the state of the object prior to processing a new signal; it is o...
 
void ResampleWaveform(BaseFloat orig_freq, const VectorBase< BaseFloat > &wave, BaseFloat new_freq, Vector< BaseFloat > *new_wave)
Downsample or upsample a waveform. 
 
void SetIndexesAndWeights()
 
MatrixIndexT NumCols() const
Returns number of columns (or zero for empty matrix). 
 
Base class which provides matrix operations not involving resizing or allocation. ...
 
int32 output_samples_in_unit_
The number of output samples in the smallest repeating unit: num_samp_out_ = samp_rate_out_hz / Gcd(s...
 
void SetRemainder(const VectorBase< BaseFloat > &input)
 
int32 NumSamplesOut() const
 
void GetIndexes(int64 samp_out, int64 *first_samp_in, int32 *samp_out_wrapped) const
Given an output-sample index, this function outputs to *first_samp_in the first input-sample index th...
 
BaseFloat FilterFunc(BaseFloat t) const
Here, t is a time in seconds representing an offset from the center of the windowed filter function...
 
void Resize(MatrixIndexT length, MatrixResizeType resize_type=kSetZero)
Set vector to a specified size (can be zero). 
 
int64 input_sample_offset_
The number of input samples we have already received for this signal (including anything in remainder...
 
Vector< BaseFloat > input_remainder_
A small trailing part of the previously seen input signal. 
 
I Lcm(I m, I n)
Returns the least common multiple of two integers. 
 
std::vector< int32 > first_index_
The first input-sample index that we sum over, for this output-sample index. 
 
void Resample(const MatrixBase< BaseFloat > &input, MatrixBase< BaseFloat > *output) const
This function does the resampling. 
 
void SetIndexes(const Vector< BaseFloat > &sample_points)
 
std::vector< Vector< BaseFloat > > weights_
 
LinearResample(int32 samp_rate_in_hz, int32 samp_rate_out_hz, BaseFloat filter_cutoff_hz, int32 num_zeros)
Constructor. 
 
MatrixIndexT Dim() const
Returns the dimension of the vector. 
 
void SetWeights(const Vector< BaseFloat > &sample_points)
 
int64 GetNumOutputSamples(int64 input_num_samp, bool flush) const
This function outputs the number of output samples we will output for a signal with "input_num_samp" ...
 
A class representing a vector. 
 
LinearResample is a special case of ArbitraryResample, where we want to resample a signal at linearly...
 
#define KALDI_ASSERT(cond)
 
MatrixIndexT NumRows() const
Returns number of rows (or zero for empty matrix). 
 
ArbitraryResample(int32 num_samples_in, BaseFloat samp_rate_hz, BaseFloat filter_cutoff_hz, const Vector< BaseFloat > &sample_points_secs, int32 num_zeros)
 
int32 input_samples_in_unit_
The number of input samples in the smallest repeating unit: num_samp_in_ = samp_rate_in_hz / Gcd(samp...
 
std::vector< Vector< BaseFloat > > weights_
Weights on the input samples, for this output-sample index. 
 
Provides a vector abstraction class. 
 
Real VecVec(const VectorBase< Real > &a, const VectorBase< Real > &b)
Returns dot product between v1 and v2. 
 
Sub-matrix representation. 
 
Represents a non-allocating general vector which can be defined as a sub-vector of higher-level vecto...
 
std::vector< int32 > first_index_