diff options
author | Yimmon Zhuang <[email protected]> | 2015-08-14 16:52:02 +0800 |
---|---|---|
committer | Yimmon Zhuang <[email protected]> | 2015-08-14 16:52:02 +0800 |
commit | 70d52a3dc6c120fe76e1109e844303e2f5e61872 (patch) | |
tree | be2d7c9bf1b2de736eceb2600a69d6bc2976e0f0 /kaldi_io/src/test.c | |
parent | 4a3308c3f6b0c7d557e9108832102d57dcc63f8e (diff) |
solve dependencies
Diffstat (limited to 'kaldi_io/src/test.c')
-rw-r--r-- | kaldi_io/src/test.c | 48 |
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; +} |