Edinburgh Speech Tools 2.4-release
EST_TrackFile.h
1 /************************************************************************/
2 /* */
3 /* Centre for Speech Technology Research */
4 /* University of Edinburgh, UK */
5 /* Copyright (c) 1996,1997 */
6 /* All Rights Reserved. */
7 /* */
8 /* Permission is hereby granted, free of charge, to use and distribute */
9 /* this software and its documentation without restriction, including */
10 /* without limitation the rights to use, copy, modify, merge, publish, */
11 /* distribute, sublicense, and/or sell copies of this work, and to */
12 /* permit persons to whom this work is furnished to do so, subject to */
13 /* the following conditions: */
14 /* 1. The code must retain the above copyright notice, this list of */
15 /* conditions and the following disclaimer. */
16 /* 2. Any modifications must be clearly marked as such. */
17 /* 3. Original authors' names are not deleted. */
18 /* 4. The authors' names are not used to endorse or promote products */
19 /* derived from this software without specific prior written */
20 /* permission. */
21 /* */
22 /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */
23 /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
24 /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
25 /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */
26 /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
27 /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
28 /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
29 /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
30 /* THIS SOFTWARE. */
31 /* */
32 /*************************************************************************/
33 /* */
34 /* Author: Richard Caley (rjc@cstr.ed.ac.uk) */
35 /* Date: Fri Nov 14 1997 */
36 /* -------------------------------------------------------------------- */
37 /* Track file formats known to the speech tools. */
38 /* */
39 /*************************************************************************/
40
41#ifndef __EST_TRACKFILE_H__
42#define __EST_TRACKFILE_H__
43
44#include "EST_Token.h"
45#include "EST_TNamedEnum.h"
46#include "EST_String.h"
47#include "EST_rw_status.h"
48#include "htk.h"
49#include "ssff.h"
50
52
53public:
54
55 // We have to use #defines for what should be done with just
56 // typedefs because Sun CC thinks you shouldn't be allowed to
57 // declare a member function via a typedef.
58
59#define LoadTrackFileArgs const EST_String filename, \
60 EST_Track &tr, float ishift, float startt
61
62#define SaveTrackFileArgs const EST_String filename, EST_Track tr
63
64#define LoadTrack_TokenStreamArgs EST_TokenStream &ts, \
65 EST_Track &tr, float ishift, float startt
66
67#define SaveTrac_TokenStreamArgs FILE *fp, EST_Track tr
68
69 typedef EST_read_status Load_File(LoadTrackFileArgs);
70 typedef EST_write_status Save_File(SaveTrackFileArgs);
71
72 typedef EST_read_status Load_TokenStream(LoadTrack_TokenStreamArgs);
73
74 typedef EST_write_status Save_TokenStream(SaveTrac_TokenStreamArgs);
75
76 typedef struct Info {
77 bool recognise;
78 Load_File *load;
79 Save_File *save;
80 const char *description;
81 } Info;
82
83 typedef struct TS_Info {
84 bool recognise;
85 Load_TokenStream *load;
86 Save_TokenStream *save;
87 const char *description;
88 } TS_Info;
89
90 static EST_write_status save_ascii(SaveTrackFileArgs);
91 static EST_read_status load_ascii(LoadTrackFileArgs);
92
93 static EST_write_status save_esps(SaveTrackFileArgs);
94 static EST_read_status load_esps(LoadTrackFileArgs);
95
96 static EST_write_status save_est_ts(SaveTrac_TokenStreamArgs);
97 static EST_read_status load_est_ts(LoadTrack_TokenStreamArgs);
98
99 static EST_write_status save_est(SaveTrackFileArgs);
100 static EST_read_status load_est(LoadTrackFileArgs);
101
102 static EST_write_status save_est_binary(SaveTrackFileArgs);
103 static EST_write_status save_est_binary_ts(SaveTrac_TokenStreamArgs);
104
105 static EST_write_status save_est_ascii(SaveTrackFileArgs);
106 static EST_read_status load_est_ascii(LoadTrackFileArgs);
107
108 static EST_write_status save_htk(SaveTrackFileArgs);
109 static EST_read_status load_htk(LoadTrackFileArgs);
110
111 static EST_write_status save_htk_fbank(SaveTrackFileArgs);
112 static EST_read_status load_htk_fbank(LoadTrackFileArgs);
113
114 static EST_write_status save_htk_mfcc_e(SaveTrackFileArgs);
115
116 static EST_write_status save_htk_mfcc(SaveTrackFileArgs);
117 static EST_read_status load_htk_mfcc(LoadTrackFileArgs);
118
119 static EST_write_status save_htk_user(SaveTrackFileArgs);
120 static EST_read_status load_htk_user(LoadTrackFileArgs);
121
122 static EST_write_status save_htk_discrete(SaveTrackFileArgs);
123 static EST_read_status load_htk_discrete(LoadTrackFileArgs);
124
125 static EST_write_status save_xmg(SaveTrackFileArgs);
126 static EST_read_status load_xmg(LoadTrackFileArgs);
127
128 static EST_write_status save_xgraph(SaveTrackFileArgs);
129 static EST_read_status load_xgraph(LoadTrackFileArgs);
130
131 static EST_write_status save_ema(SaveTrackFileArgs);
132 static EST_read_status load_ema(LoadTrackFileArgs);
133
134 static EST_write_status save_ema_swapped(SaveTrackFileArgs);
135 static EST_read_status load_ema_swapped(LoadTrackFileArgs);
136
137 static EST_write_status save_NIST(SaveTrackFileArgs);
138 static EST_read_status load_NIST(LoadTrackFileArgs);
139
140 static EST_write_status save_ssff_ts(SaveTrac_TokenStreamArgs);
141 static EST_read_status load_ssff_ts(LoadTrack_TokenStreamArgs);
142
143 static EST_write_status save_ssff(SaveTrackFileArgs);
144 static EST_read_status load_ssff(LoadTrackFileArgs);
145
148
149 static EST_String options_supported(void);
150 static EST_String options_short(void);
151};
152
153int track_to_espsf0(EST_Track &track, EST_Track &fz);
154int espsf0_to_track(EST_Track &fz);
155
156int track_to_htk_lpc(EST_Track &track, EST_Track &lpc);
157
158EST_write_status put_esps(const char *filename, const char *style, float *t, float *a,
159 int *v, float fsize, float rate, int num_points);
160
161enum EST_write_status put_track_esps(const char *filename, char **f_names,
162 float **a, float fsize, float rate,
163 int order, int num_points,
164 short fixed);
165
166EST_read_status get_esps(const char *filename, const char *style,
167 float **t, float **a, int **v, float *fsize, int *num_points);
168
169EST_read_status get_track_esps(const char *filename, char ***fields, float
170 ***a, float *fsize, int *num_points, int *num_fields,
171 short *fixed);
172
173#endif