1 /**
2  * @file   htk_param.h
3  *
4  * <EN>
5  * @brief Structures for storing input speech parameters
6  *
7  * This file defines a structure for holding a vector sequence of
8  * input speech parameters.  The speech parameter sequence will be
9  * stored in HTK_Param.  The HTK_Param also holds information about
10  * the extraction condition, i.e., frame shift length, window size and
11  * so on.
12  *
13  * The speech input vector can be read from HTK parameter file, or
14  * Julius extracts the parameters directly from input speech.  Julius
15  * supports extraction of only MFCC format of fixed dimension.
16  * More precisely, only parameter type of MFCC_{0|E}_D[_Z][_N] with {25|26}
17  * dimensions is supported.
18  *
19  * When recognition, the parameter types of both acoustic model and
20  * input parameter should be the same.  Please note that only the
21  * parameter type is checked, and other parameters such as source sampling
22  * rate, frame shift length and window sizes will not be checked.
23  * </EN>
24  * <JA>
25  * @brief HTK����ħ�ѥ�᡼�����ݻ����빽¤�Τ˴�Ϣ�������
26  *
27  * ���Υե�����ˤϡ�������ħ�̤Υ٥��ȥ������ݻ����빽¤�Τ�
28  * �������Ƥ��ޤ������ϲ�������׻����줿MFCC���β�����ħ�̤ϡ�
29  * �������������빽¤�� HTK_Param ����¸����ޤ���HTK_Param�ˤ�
30  * �ޤ�����ħ����л��Υե졼�ॷ�ե����䥦����ɥ�Ĺ�ʤɤξ���
31  * �ݻ�����ޤ���
32  *
33  * ������ħ�̤ϳ����� HTK �ʤɤˤ�ä���Ф��줿HTK��������ħ�̥ե������
34  * �ɤ߹��ळ�Ȥ��Ǥ��ޤ����ޤ���MFCC �����Ǥ���� Julius ���
35  * ľ�ܲ����ȷ�������Ф��뤳�Ȥ��Ǥ��ޤ����ºݤ�Julius����������Ф���
36  * ���뤳�Ȥ��Ǥ�����ħ�̤� {25|26} ������ MFCC_{0|E}_D[_Z][_N] �ΤߤǤ���
37  *
38  * ���Ѥ��벻����ǥ�(%HMM)���ؽ������Ѥ�����ħ�̤�ǧ���оݤȤ������Ϥ�
39  * ��ħ�̤η����ϰ��פ�����ɬ�פ�����ޤ���ǧ���¹Ի��ˤϡ�������ǥ������
40  * �ե��������ħ�̷����������å����졤Ŭ�礷�ʤ����ϥ��顼�Ȥʤ�ޤ���
41  * �����������ϲ����Υ���ץ�����ȿ���ե졼�ॷ�ե�����������ɥ�Ĺ��
42  * �����HTK�����β�����ǥ�ˤ��ݻ�����Ƥ��ʤ����ᡤ�����å��Ǥ��ޤ���
43  * ��դ��Ʋ�������
44  * </JA>
45  *
46  * @sa htk_defs.h
47  *
48  * @author Akinobu LEE
49  * @date   Fri Feb 11 02:52:52 2005
50  *
51  * $Revision: 1.2 $
52  *
53  */
54 /*
55  * Copyright (c) 1991-2007 Kawahara Lab., Kyoto University
56  * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology
57  * Copyright (c) 2005-2007 Julius project team, Nagoya Institute of Technology
58  * All rights reserved
59  */
60 
61 #ifndef __SENT_HTK_PARAM_H__
62 #define __SENT_HTK_PARAM_H__
63 
64 #include <sent/stddefs.h>
65 #include <sent/htk_defs.h>
66 
67 /// Parameter types and extraction conditions
68 typedef struct {
69   unsigned int samplenum;	///< Number of samples (or frames)
70   unsigned int wshift;		///< Window shift (unit: 100ns)
71   unsigned short sampsize;	///< Bytes per sample
72   short samptype;		///< Parameter type, see also htk_defs.h
73 } HTK_Param_Header;
74 
75 /// Input speech parameter
76 typedef struct {
77   HTK_Param_Header header;	///< Parameter header information
78   unsigned int samplenum;	///< Number of sample (same in header.samplenum)
79   short veclen;			///< Vector length of a sample
80   VECT **parvec;		///< Actual parameter vectors [0..samplenum-1][0..veclen-1]
81   short veclen_alloc;		///< Allocated vector length of a sample
82   unsigned int samplenum_alloc;	///< Alllocated number of samples
83   BMALLOC_BASE *mroot;		///< Pointer for block memory allocation
84 } HTK_Param;
85 
86 /**
87  * Increment step of HTK Parameter holder in frames
88  *
89  */
90 #define HTK_PARAM_INCREMENT_STEP_FRAME 200
91 
92 boolean rdparam(char *, HTK_Param *);
93 HTK_Param *new_param();
94 void free_param(HTK_Param *);
95 short param_qualstr2code(char *);
96 short param_str2code(char *);
97 char *param_qualcode2str(char *, short, boolean);
98 char *param_code2str(char *, short, boolean);
99 int guess_basenum(HTK_Param *p, short qualtype);
100 boolean param_strip_zero(HTK_Param *param);
101 
102 void param_init_content(HTK_Param *p);
103 boolean param_alloc(HTK_Param *p, unsigned int samplenum, short veclen);
104 void param_free_content(HTK_Param *p);
105 
106 
107 /* hmminfo/put_htkdata_info.c */
108 void put_param_head(FILE *fp, HTK_Param_Header *h);
109 void put_vec(FILE *fp, VECT **p, int num, short veclen);
110 void put_param(FILE *fp, HTK_Param *pinfo);
111 void put_param_info(FILE *fp, HTK_Param *pinfo);
112 
113 #endif /* __SENT_HTK_PARAM_H__ */
114