Edinburgh Speech Tools  2.1-release
EST_wave_aux.h
Go to the documentation of this file.
1 /*************************************************************************/
2 /* */
3 /* Centre for Speech Technology Research */
4 /* University of Edinburgh, UK */
5 /* Copyright (c) 1996 */
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 /* Author : Paul Taylor and Alan Black */
34 /* Date : May 1996 */
35 /*-----------------------------------------------------------------------*/
36 /* EST_Wave class auxiliary functions */
37 /* */
38 /*=======================================================================*/
39 
40 
41 /**@name EST_wave_aux
42 Auxiliary functions for processing waveforms.
43  */
44 
45 ///@{
46 
47 #ifndef __EST_WAVE_AUX_H__
48 #define __EST_WAVE_AUX_H__
49 
50 #include "EST_String.h"
51 #include "EST_Wave.h"
53 #include "EST_Option.h"
54 #include "EST_FMatrix.h"
55 #include "EST_TNamedEnum.h"
56 
57 
58 int wave_extract_channel(EST_Wave &single, const EST_Wave &multi, int channel);
59 
60 void wave_combine_channels(EST_Wave &combined, const EST_Wave &multi);
61 
62 int wave_subwave(EST_Wave &subsig,EST_Wave &sig,int offset,int length);
63 
64 int wave_divide(EST_WaveList &wl, EST_Wave &sig, EST_Relation &keylab,
65  const EST_String &ext);
66 
67 int wave_extract(EST_Wave &part, EST_Wave &sig, EST_Relation &keylab,
68  const EST_String &file);
69 
70 void add_waves(EST_Wave &s, const EST_Wave &m);
71 
73 float rms_error(EST_Wave &a, EST_Wave &b, int channel);
74 float abs_error(EST_Wave &a, EST_Wave &b, int channel);
75 float correlation(EST_Wave &a, EST_Wave &b, int channel);
76 
80 
81 EST_Wave error(EST_Wave &ref, EST_Wave &test, int relax);
82 
83 void absolute(EST_Wave &a);
84 
85 EST_read_status read_wave(EST_Wave &sig, const EST_String &in_file,
86  EST_Option &al);
87 EST_write_status write_wave(EST_Wave &sig, const EST_String &in_file, EST_Option &al);
88 void wave_info(EST_Wave &w);
89 void invert(EST_Wave &sig);
90 
91 
92 void differentiate(EST_Wave &sig);
93 void reverse(EST_Wave &sig);
94 
95 void ulaw_to_short(const unsigned char *ulaw,short *data,int length);
96 void alaw_to_short(const unsigned char *alaw,short *data,int length);
97 void uchar_to_short(const unsigned char *chars,short *data,int length);
98 void short_to_char(const short *data,unsigned char *chars,int length);
99 void short_to_ulaw(const short *data,unsigned char *ulaw,int length);
100 void short_to_alaw(const short *data,unsigned char *alaw,int length);
101 
102 // Used when setting Waves in Features
104 
118 
119 
121  const int num_samples, const int num_channels,
122  const int sample_rate,
123  const EST_String& stype, const int bo,
124  const EST_String& ftype);
125 
127 
128 #endif /* __EST_WAVE_AUX_H__ */
129 
130 ///@}
A class for storing digital waveforms. The waveform is stored as an array of 16 bit shorts...
Definition: EST_Wave.h:64
int wave_subwave(EST_Wave &subsig, EST_Wave &sig, int offset, int length)
EST_write_status
void uchar_to_short(const unsigned char *chars, short *data, int length)
A vector class for floating point numbers. EST_FVector x should be used instead of float *x wherever ...
Definition: EST_FMatrix.h:119
int wave_extract_channel(EST_Wave &single, const EST_Wave &multi, int channel)
void short_to_ulaw(const short *data, unsigned char *ulaw, int length)
EST_TNamedEnum< EST_sample_type_t > EST_sample_type_map
void short_to_alaw(const short *data, unsigned char *alaw, int length)
void alaw_to_short(const unsigned char *alaw, short *data, int length)
int wave_extract(EST_Wave &part, EST_Wave &sig, EST_Relation &keylab, const EST_String &file)
float abs_error(EST_Wave &a, EST_Wave &b, int channel)
void ulaw_to_short(const unsigned char *ulaw, short *data, int length)
EST_Wave difference(EST_Wave &a, EST_Wave &b)
#define VAL_REGISTER_CLASS_DCLS(NAME, CLASS)
Definition: EST_Val_defs.h:44
float correlation(EST_Wave &a, EST_Wave &b, int channel)
enum EST_write_status wave_io_save_header(FILE *fp, const int num_samples, const int num_channels, const int sample_rate, const EST_String &stype, const int bo, const EST_String &ftype)
void wave_info(EST_Wave &w)
int wave_divide(EST_WaveList &wl, EST_Wave &sig, EST_Relation &keylab, const EST_String &ext)
EST_write_status write_wave(EST_Wave &sig, const EST_String &in_file, EST_Option &al)
void wave_combine_channels(EST_Wave &combined, const EST_Wave &multi)
EST_read_status
void absolute(EST_Wave &a)
void add_waves(EST_Wave &s, const EST_Wave &m)
EST_read_status read_wave(EST_Wave &sig, const EST_String &in_file, EST_Option &al)
EST_Wave error(EST_Wave &ref, EST_Wave &test, int relax)
EST_sample_type_t
Definition: EST_wave_aux.h:105
void differentiate(EST_Wave &sig)
Definition: EST_wave_aux.cc:76
void short_to_char(const short *data, unsigned char *chars, int length)
LISP fp
Definition: kkcompile.cc:63
void reverse(EST_Wave &sig)
float rms_error(EST_Wave &a, EST_Wave &b, int channel)
void invert(EST_Wave &sig)