28 using namespace kaldi;
37 std::cout <<
"=== UnitTestSimple() ===\n";
44 v(
i) = (abs(
i * 433024253 ) % 65535) - (65535 / 2);
47 std::cout <<
"<<<=== Just make sure it runs... Nothing is compared\n";
67 std::cout <<
"Test passed :)\n\n";
72 std::cout <<
"=== UnitTestHTKCompare1() ===\n";
74 std::ifstream is(
"test_data/test.wav", std::ios_base::binary);
83 std::ifstream is(
"test_data/test.wav.plp_htk.1",
84 std::ios::in | std::ios_base::binary);
85 bool ans =
ReadHtk(is, &htk_features, 0);
105 plp.
Compute(waveform, 1.0, &kaldi_raw_features);
123 if ((std::abs(b - a)) > 0.10) {
126 std::cout <<
"\n\n\n[HTK-row: " <<
i <<
"] " << htk_features.Row(
i) <<
"\n";
127 std::cout <<
"[Kaldi-row: " <<
i <<
"] " << kaldi_features.
Row(
i) <<
"\n\n\n";
131 std::cout <<
"[" <<
i <<
", " <<
j <<
"]";
140 static_cast<int16
>(
sizeof(
float)*kaldi_features.
NumCols()),
144 std::ofstream os(
"tmp.test.wav.plp_kaldi.1",
145 std::ios::out|std::ios::binary);
146 WriteHtk(os, kaldi_features, header);
149 std::cout <<
"Test passed :)\n\n";
151 unlink(
"tmp.test.wav.plp_kaldi.1");
167 for (
int i = 0;
i < 5;
i++)
169 std::cout <<
"Tests succeeded.\n";
171 }
catch (
const std::exception &e) {
172 std::cerr << e.what();
void Read(std::istream &is)
Read() will throw on error.
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
static void UnitTestHTKCompare1()
void Compute(const VectorBase< BaseFloat > &wave, BaseFloat vtln_warp, Matrix< BaseFloat > *output)
MatrixIndexT NumCols() const
Returns number of columns (or zero for empty matrix).
bool WriteHtk(std::ostream &os, const MatrixBase< Real > &M, HtkHeader htk_hdr)
static void UnitTestSimple()
const Matrix< BaseFloat > & Data() const
const SubVector< Real > Row(MatrixIndexT i) const
Return specific row of matrix [const].
FrameExtractionOptions frame_opts
MatrixIndexT Dim() const
Returns the dimension of the vector.
This class's purpose is to read in Wave files.
A class representing a vector.
#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)
PlpOptions contains basic options for computing PLP features.
This templated class is intended for offline feature extraction, i.e.
bool ReadHtk(std::istream &is, Matrix< Real > *M_ptr, HtkHeader *header_ptr)
Extension of the HTK header.
static void UnitTestFeat()
Represents a non-allocating general vector which can be defined as a sub-vector of higher-level vecto...