26 using namespace kaldi;
29 #define BY(n,k) ((char)((uint32)(n) >> (8 * (k)) & 0xFF)) 30 #define WRD(n) BY(n,0), BY(n,1) 31 #define DWRD(n) BY(n,0), BY(n,1), BY(n,2), BY(n,3) 42 const int byps = hz * 2 * 2 ;
43 const char file_data[] = {
63 const char expect_mat[] =
"[ 0 -32768 32767 \n -1 0 1 ]";
66 std::istringstream iws(std::string(file_data,
sizeof file_data),
67 std::ios::in | std::ios::binary);
72 std::istringstream ies(expect_mat, std::ios::in);
74 expected.
Read(ies,
false );
90 const int byps = hz * 1 * 2 ;
91 const char file_data[] = {
109 const char expect_mat[] =
"[ 0 -1 -32768 32767 1 ]";
112 std::istringstream iws(std::string(file_data,
sizeof file_data),
113 std::ios::in | std::ios::binary);
118 std::istringstream ies(expect_mat, std::ios::in);
120 expected.
Read(ies,
false );
129 const int byps = hz * 1 * 2 ;
130 const char file_data[] = {
148 const char expect_mat[] =
"[ 1 2 3 ]";
151 std::istringstream iws(std::string(file_data,
sizeof file_data),
152 std::ios::in | std::ios::binary);
157 std::istringstream ies(expect_mat, std::ios::in);
159 expected.
Read(ies,
false );
166 const int byps = hz * 1 * 2 ;
167 const char file_data[] = {
185 const char expect_mat[] =
"[ 1 2 3 ]";
188 std::istringstream iws(std::string(file_data,
sizeof file_data),
189 std::ios::in | std::ios::binary);
194 std::istringstream ies(expect_mat, std::ios::in);
196 expected.
Read(ies,
false );
211 std::cout <<
"LGTM\n";
213 }
catch (
const std::exception &e) {
214 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 UnitTestEndless1()
BaseFloat SampFreq() const
const Matrix< BaseFloat > & Data() const
void Read(std::istream &in, bool binary, bool add=false)
read from stream.
static void UnitTestEndless2()
This class's purpose is to read in Wave files.
static void AssertEqual(float a, float b, float relative_tolerance=0.001)
assert abs(a - b) <= relative_tolerance * (abs(a)+abs(b))
BaseFloat Duration() const
static void UnitTestMono22K()
static void UnitTestStereo8K()