Nsound  0.9.4
FilterParametricEqualizer.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // $Id: FilterParametricEqualizer.h 874 2014-09-08 02:21:29Z weegreenblobbie $
4 //
5 // Nsound is a C++ library and Python module for audio synthesis featuring
6 // dynamic digital filters. Nsound lets you easily shape waveforms and write
7 // to disk or plot them. Nsound aims to be as powerful as Csound but easy to
8 // use.
9 //
10 // Copyright (c) 2008 Nick Hilton
11 //
12 // weegreenblobbie_yahoo_com (replace '_' with '@' and '.')
13 //
14 //-----------------------------------------------------------------------------
15 
16 //-----------------------------------------------------------------------------
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 // This program is distributed in the hope that it will be useful,
24 // but WITHOUT ANY WARRANTY; without even the implied warranty of
25 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 // GNU Library General Public License for more details.
27 //
28 // You should have received a copy of the GNU General Public License
29 // along with this program; if not, write to the Free Software
30 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 //
32 //-----------------------------------------------------------------------------
33 #ifndef _NSOUND_FILTER_PARAMETRIC_EQUALIZER_H_
34 #define _NSOUND_FILTER_PARAMETRIC_EQUALIZER_H_
35 
36 #include <Nsound/Filter.h>
37 #include <Nsound/Kernel.h>
38 
39 namespace Nsound
40 {
41 
42 // Forward class declarations
43 class AudioStream;
44 class Buffer;
45 
46 //-----------------------------------------------------------------------------
47 //
49 //
97 //
99 {
100  public:
101 
102  enum Type
103  {
107  };
108 
111  const Type & type,
112  const float64 & sample_rate,
113  const float64 & frequency,
114  const float64 & resonance = 0.707106781187,
115  const float64 & boost_dB = 0.0);
116 
117  virtual ~FilterParametricEqualizer();
118 
120  filter(const AudioStream & x);
121 
123  filter(const AudioStream & x, const Buffer & frequencies);
124 
126  filter(
127  const AudioStream & x,
128  const Buffer & frequencies,
129  const Buffer & resonance);
130 
133  filter(
134  const AudioStream & x,
135  const Buffer & frequencies,
136  const Buffer & resonance,
137  const Buffer & boost_dB);
138 
139  Buffer
140  filter(const Buffer & x);
141 
142  Buffer
143  filter(const Buffer & x, const Buffer & frequencies);
144 
145  Buffer
146  filter(
147  const Buffer & x,
148  const Buffer & frequencies,
149  const Buffer & resonance);
150 
152  Buffer
153  filter(
154  const Buffer & x,
155  const Buffer & frequencies,
156  const Buffer & resonance,
157  const Buffer & boost_dB);
158 
159  float64
160  filter(const float64 & x);
161 
162  float64
163  filter(const float64 & x, const float64 & frequency);
164 
166  float64
167  filter(
168  const float64 & x,
169  const float64 & frequency,
170  const float64 & resonance);
171 
173  float64
174  filter(
175  const float64 & x,
176  const float64 & frequency,
177  const float64 & resonance,
178  const float64 & boost_dB);
179 
180  void
181  makeKernel(
182  const float64 & frequency,
183  const float64 & resonance,
184  const float64 & boost);
185 
186  void
187  plot(
188  boolean show_fc = true,
189  boolean show_phase = false);
190 
191  void
192  reset();
193 
194  protected:
195 
200 
203 
207 
211 
213 
214  private:
215 
217 
220 
221 };
222 
223 };
224 
225 // :mode=c++: jEdit modeline
226 #endif
Implementation of Zoelzer's parametric equalizer filters, with some modifications by the author...
FilterParametricEqualizer(const Type &type, const float64 &sample_rate, const float64 &frequency, const float64 &resonance=0.707106781187, const float64 &boost_dB=0.0)
boost is in dB
std::set< Kernel > KernelCache
Definition: Kernel.h:180
void plot(boolean show_fc=true, boolean show_phase=false)
FilterParametricEqualizer & operator=(const FilterParametricEqualizer &rhs)
double float64
Definition: Nsound.h:146
Base class for IIR Filters, defines the interface.
Definition: Filter.h:49
AudioStream filter(const AudioStream &x)
void makeKernel(const float64 &frequency, const float64 &resonance, const float64 &boost)
A Buffer for storing audio samples.
Definition: Buffer.h:60