Mercurial > hg > aimc
comparison trunk/src/Modules/Output/FileOutputHTK.h @ 279:f469d936337f
- Replacing tabs with spaces for indentation
author | tomwalters |
---|---|
date | Thu, 18 Feb 2010 20:04:04 +0000 |
parents | 6b4921704eb1 |
children | e55d0c225a57 |
comparison
equal
deleted
inserted
replaced
278:5b8b9ea1218a | 279:f469d936337f |
---|---|
15 #include "Support/Module.h" | 15 #include "Support/Module.h" |
16 #include "Support/SignalBank.h" | 16 #include "Support/SignalBank.h" |
17 | 17 |
18 | 18 |
19 // Defines taken from HTKwrite.c and The HTK Book | 19 // Defines taken from HTKwrite.c and The HTK Book |
20 #define H_WAVEFORM 0 //sampled waveform | 20 #define H_WAVEFORM 0 //sampled waveform |
21 #define H_LPC 1 //linear prediction filter coefficients | 21 #define H_LPC 1 //linear prediction filter coefficients |
22 #define H_LPREFC 2 //linear prediction reflection coefficients | 22 #define H_LPREFC 2 //linear prediction reflection coefficients |
23 #define H_LPCEPSTRA 3 //LPC cepstral coefficients | 23 #define H_LPCEPSTRA 3 //LPC cepstral coefficients |
24 #define H_LPDELCEP 4 //LPC cepstra plus delta coefficients | 24 #define H_LPDELCEP 4 //LPC cepstra plus delta coefficients |
25 #define H_IREFC 5 //LPC reflection coef in 16 bit integer format | 25 #define H_IREFC 5 //LPC reflection coef in 16 bit integer format |
26 #define H_MFCC 6 //mel-frequency cepstral coefficients | 26 #define H_MFCC 6 //mel-frequency cepstral coefficients |
27 #define H_FBANK 7 //log mel-filter bank channel outputs | 27 #define H_FBANK 7 //log mel-filter bank channel outputs |
28 #define H_MELSPEC 8 //linear mel-filter bank channel outputs | 28 #define H_MELSPEC 8 //linear mel-filter bank channel outputs |
29 #define H_USER 9 //user defined sample kind | 29 #define H_USER 9 //user defined sample kind |
30 #define H_DISCRETE 10 //vector quantised data | 30 #define H_DISCRETE 10 //vector quantised data |
31 #define H_PLP 11 // Perceptual Linear Prediction | 31 #define H_PLP 11 // Perceptual Linear Prediction |
32 #define H_ANON 12 | 32 #define H_ANON 12 |
33 | 33 |
34 #define H_E 64 //has energy | 34 #define H_E 64 //has energy |
35 #define H_N 128 //absolute energy suppressed | 35 #define H_N 128 //absolute energy suppressed |
36 #define H_D 256 //has delta coefficients | 36 #define H_D 256 //has delta coefficients |
37 #define H_A 512 //has acceleration coefficients | 37 #define H_A 512 //has acceleration coefficients |
61 * \sa Signal, SignalBank | 61 * \sa Signal, SignalBank |
62 */ | 62 */ |
63 namespace aimc { | 63 namespace aimc { |
64 class FileOutputHTK : public Module { | 64 class FileOutputHTK : public Module { |
65 public: | 65 public: |
66 /*! \brief Create a new file output for an HTK format file. Use of this | 66 /*! \brief Create a new file output for an HTK format file. Use of this |
67 * class only really makes sense for the output of 1-D frames. | 67 * class only really makes sense for the output of 1-D frames. |
68 */ | 68 */ |
69 FileOutputHTK(Parameters *pParam); | 69 FileOutputHTK(Parameters *pParam); |
70 ~FileOutputHTK(); | 70 ~FileOutputHTK(); |
71 | 71 |
72 /*! \brief Initialize the output to HTK. | 72 /*! \brief Initialize the output to HTK. |
73 * \param *filename Filename of the ouptut file to be created. | 73 * \param *filename Filename of the ouptut file to be created. |
74 * If the file exists it will be overwritten | 74 * If the file exists it will be overwritten |
75 * \return Returns true on success of initialization. | 75 * \return Returns true on success of initialization. |
76 */ | 76 */ |
77 bool OpenFile(const char *filename, float frame_period_ms); | 77 bool OpenFile(const char *filename, float frame_period_ms); |
78 bool CloseFile(); | 78 bool CloseFile(); |
79 virtual void Process(const SignalBank &input); | 79 virtual void Process(const SignalBank &input); |
80 protected: | 80 private: |
81 virtual bool InitializeInternal(const SignalBank &input); | 81 virtual bool InitializeInternal(const SignalBank &input); |
82 virtual void ResetInternal(); | 82 virtual void ResetInternal(); |
83 | 83 |
84 float ByteSwapFloat(float d); | 84 float ByteSwapFloat(float d); |
85 | 85 |
86 void WriteHeader(int nelements, float sampPeriod); | 86 void WriteHeader(int nelements, float sampPeriod); |
87 | 87 |
88 //! \brief Whether initialization is done or not | 88 //! \brief Whether initialization is done or not |
89 bool header_written_; | 89 bool header_written_; |
90 | 90 |
91 //! \brief Filename | 91 //! \brief Filename |
92 char filename_[PATH_MAX]; | 92 char filename_[PATH_MAX]; |
93 //! \brief Internal pointer to the output file | 93 //! \brief Internal pointer to the output file |
94 FILE *file_handle_; | 94 FILE *file_handle_; |
95 | 95 |
96 //! \brief Count of the number of samples in the file, written on close | 96 //! \brief Count of the number of samples in the file, written on close |
97 int sample_count_; | 97 int sample_count_; |
98 | 98 |
99 int channel_count_; | 99 int channel_count_; |
100 int buffer_length_; | 100 int buffer_length_; |
101 float frame_period_ms_; | 101 float frame_period_ms_; |
102 }; | 102 }; |