blob: e92b4c9544a8a9888fe14f6e6e2de5613a62d840 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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;
}
|