28 using namespace kaldi;
31 std::cout <<
"=== UnitTestSDCCompareWithDeltaFeatures() ===\n";
33 deltas_opts.
window = window;
35 shifted_deltas_opts.
window = window;
43 &shifted_deltas_features);
55 for (
int32 i = 0;
i < dd_num_rows;
i++) {
56 for (
int32 j = 0;
j < 2 * num_features;
j++) {
57 BaseFloat a = deltas_features(
i,
j), b = shifted_deltas_features(
i,
j);
65 std::cout <<
"=== UnitTestSDCParams() ===\n";
67 shifted_deltas_opts.
window = window;
74 &shifted_deltas_features);
80 KALDI_ASSERT(sdc_num_cols == raw_num_cols * (n_blocks + 1));
92 for (
int32 i = 0;
i < sdc_num_rows;
i++) {
93 for (
int32 j = 2 * raw_num_cols;
j < sdc_num_cols;
j += raw_num_cols) {
94 for (
int32 k = 0; k < raw_num_cols; k++) {
95 int32 row =
i + (
j/raw_num_cols - 1) * shift;
96 if (row < sdc_num_rows) {
98 BaseFloat b = shifted_deltas_features(row, raw_num_cols + k);
108 std::cout <<
"=== UnitTestSDCEndEffects() ===\n";
110 shifted_deltas_opts.
window = window;
117 &shifted_deltas_features);
123 for (
int32 i = sdc_num_rows - n_blocks + 1;
i < sdc_num_rows;
i++) {
124 for (
int32 j = 2 * raw_num_cols;
j < sdc_num_cols;
j += raw_num_cols) {
125 for (
int32 k = 0; k < raw_num_cols; k++) {
126 if (
i + (
j/raw_num_cols - 1) * shift - window/2 > sdc_num_rows)
134 std::ifstream is(
"test_data/test.wav", std::ios_base::binary);
143 op.frame_opts.preemph_coeff = 0.0;
144 op.frame_opts.window_type =
"hamming";
145 op.frame_opts.remove_dc_offset =
false;
146 op.frame_opts.round_to_power_of_two =
true;
147 op.mel_opts.low_freq = 0.0;
148 op.use_energy =
false;
151 mfcc.
Compute(waveform, 1.0, &raw_features);
154 for (
int32 window = 1; window < 4; window++) {
156 for (
int32 shift = 1; shift < 10; shift++) {
157 for (
int32 n_blocks = 1; n_blocks < 20; n_blocks += 3) {
164 }
catch (
const std::exception &e) {
165 static_cast<void>(e);
void Read(std::istream &is)
Read() will throw on error.
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void Compute(const VectorBase< BaseFloat > &wave, BaseFloat vtln_warp, Matrix< BaseFloat > *output)
MatrixIndexT NumCols() const
Returns number of columns (or zero for empty matrix).
MfccOptions contains basic options for computing MFCC features.
static void UnitTestParams(Matrix< BaseFloat > &raw_features, int32 window, int32 shift, int32 n_blocks)
const Matrix< BaseFloat > & Data() const
static void UnitTestCompareWithDeltaFeatures(Matrix< BaseFloat > &raw_features, int32 window)
FrameExtractionOptions frame_opts
void ComputeShiftedDeltas(const ShiftedDeltaFeaturesOptions &delta_opts, const MatrixBase< BaseFloat > &input_features, Matrix< BaseFloat > *output_features)
This class's purpose is to read in Wave files.
#define KALDI_ASSERT(cond)
MatrixIndexT NumRows() const
Returns number of rows (or zero for empty matrix).
void ComputeDeltas(const DeltaFeaturesOptions &delta_opts, const MatrixBase< BaseFloat > &input_features, Matrix< BaseFloat > *output_features)
static void UnitTestEndEffects(Matrix< BaseFloat > &raw_features, int32 window, int32 shift, int32 n_blocks)
This templated class is intended for offline feature extraction, i.e.
Represents a non-allocating general vector which can be defined as a sub-vector of higher-level vecto...