summaryrefslogtreecommitdiff
path: root/kaldi_io/src/test.c
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2015-08-14 11:51:42 +0800
committerDeterminant <[email protected]>2015-08-14 11:51:42 +0800
commit96a32415ab43377cf1575bd3f4f2980f58028209 (patch)
tree30a2d92d73e8f40ac87b79f6f56e227bfc4eea6e /kaldi_io/src/test.c
parentc177a7549bd90670af4b29fa813ddea32cfe0f78 (diff)
add implementation for kaldi io (by ymz)
Diffstat (limited to 'kaldi_io/src/test.c')
-rw-r--r--kaldi_io/src/test.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/kaldi_io/src/test.c b/kaldi_io/src/test.c
new file mode 100644
index 0000000..e92b4c9
--- /dev/null
+++ b/kaldi_io/src/test.c
@@ -0,0 +1,48 @@
+/*********************************************************************************
+* File Name : test.c
+* Created By : YIMMON, [email protected]
+* Creation Date : [2015-08-05 17:39]
+* Last Modified : [2015-08-06 14:28]
+* Description :
+**********************************************************************************/
+
+#include "cwrapper_kaldi.h"
+#include <stdio.h>
+
+char feature_rspecifier[] = {"ark:/slfs6/users/ymz09/kaldi/src/featbin/copy-feats scp:/slfs6/users/ymz09/swb_ivec/train_bp.scp ark:- |"};
+
+void print_nerv_matrix(Matrix *mat) {
+ int n = mat->nrow;
+ int m = mat->ncol;
+ int i, j;
+ size_t stride = mat->stride;
+ for (i = 0; i < n; i++)
+ {
+ float *nerv_row = (float *)((char *)mat->data.f + i * stride);
+ for (j = 0; j < m; j++)
+ printf("%.8f ", nerv_row[j]);
+ puts("");
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ Matrix *mat;
+ KaldiFeatureRepo *repo = kaldi_feature_repo_new(feature_rspecifier);
+
+ mat = kaldi_feature_repo_read_utterance(repo, NULL, 1);
+ printf("1st uttrance\n");
+ print_nerv_matrix(mat);
+
+ kaldi_feature_repo_next(repo);
+
+ mat = kaldi_feature_repo_read_utterance(repo, NULL, 1);
+ printf("2nd uttrance\n");
+ print_nerv_matrix(mat);
+
+ printf("is end: %d\n", kaldi_feature_repo_is_end(repo));
+
+ kaldi_feature_repo_destroy(repo);
+
+ return 0;
+}