Edinburgh Speech Tools  2.4-release
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Pages
EST_filter_design.h
1 /*************************************************************************/
2 /* */
3 /* Centre for Speech Technology Research */
4 /* University of Edinburgh, UK */
5 /* Copyright (c) 1995,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 
34 #ifndef __EST_FILTER_DESIGN_H__
35 #define __EST_FILTER_DESIGN_H__
36 
37 #include "EST_Wave.h"
38 #include "EST_FMatrix.h"
39 #include "EST_Track.h"
40 
41 /**@name Filter Design
42 
43 FIR Filtering is a 2 stage process, first involving design and then
44 the filtering itself. As the design is somewhat costly, it is usually
45 desirable to design a filter outside the main loop.
46 
47 For one off filtering operations, functions are
48 provided which design and filter the waveform in a single go.
49 
50 It is impossible to design an ideal filter, i.e. one which exactly
51 obeys the desired frequency response. The "quality" of a filter is
52 given by the order parameter, with high values indicating good
53 approximations to desired responses. High orders are slower. The
54 default is 199 which gives a pretty good filter, but a value as low as
55 19 is still usable if speech is important.
56 
57 */
58 //@{
59 
60 /** Create an arbitrary filter or order {\tt order} that attempts to
61 give the frequency response given by {\tt freq_response}. The vector
62 {\tt freq_response} should be any size 2**N and contain a plot of the
63 desired frequency response with values ranging between 0.0 and
64 1.0. The actual filtering is done by \Ref{FIRfilter}.
65 
66 @see design_lowpass_FIR_filter, design_highpass_FIR_filter
67 @see FIRfilter, FIRlowpass_filter, FIRhighpass_filter
68 
69 */
70 EST_FVector design_FIR_filter(const EST_FVector &freq_response, int
71  filter_order);
72 
73 /** Design a FIR lowpass filter of order {\tt order} and cut-off
74 frequency {\tt freq}. The filter coefficients are returned in the
75 FVector and should be used in conjunction with \Ref{FIRfilter}.
76 
77 @see design_FIR_filter, design_highpass_FIR_filter, FIRfilter,
78 FIRlowpass_filter, FIRhighpass_filter
79 */
80 
81 EST_FVector design_lowpass_FIR_filter(int sample_rate, int freq, int
82  order);
83 
84 /** Design a FIR highpass filter of order {\tt order} and cut-off frequency
85 {\tt freq}. The filter coefficients are returned in the FVector and should be used in conjunction with \Ref{FIRfilter}
86 @see design_FIR_filter, design_lowpass_FIR_filter, design_highpass_FIR_filter
87 @see FIRfilter, FIRlowpass_filter, FIRhighpass_filter
88 
89 */
90 EST_FVector design_highpass_FIR_filter(int sample_rate, int
91  freq, int order);
92 
93 //@}
94 
95 
96 #endif /* __EST_FILTER_DESIGN_H__ */
97