Nsound  0.9.4
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
Nsound::FilterLowPassFIR Class Reference

#include <Nsound/FilterLowPassFIR.h>

Inheritance diagram for Nsound::FilterLowPassFIR:
Inheritance graph
[legend]

Classes

struct  Kernel
 A class to store calculated kernels. More...
 

Public Member Functions

 FilterLowPassFIR (const float64 &sample_rate, uint32 kernel_size, const float64 &cutoff_frequency_Hz)
 
virtual ~FilterLowPassFIR ()
 
AudioStream filter (const AudioStream &x)
 
AudioStream filter (const AudioStream &x, const float64 &frequency)
 
AudioStream filter (const AudioStream &x, const Buffer &frequencies)
 
Buffer filter (const Buffer &x)
 
Buffer filter (const Buffer &x, const float64 &frequency)
 
Buffer filter (const Buffer &x, const Buffer &frequencies)
 
virtual float64 filter (const float64 &x)
 
float64 filter (const float64 &x, const float64 &frequency_Hz)
 
float64 getFrequency () const
 
Buffer getImpulseResponse ()
 
void plot (boolean show_fc=true, boolean show_phase=false)
 
void reset ()
 
void setCutoff (const float64 &fc)
 Sets the cut off frequency (Hz). More...
 
void setRealtime (bool flag)
 
Buffer getFrequencyAxis (const uint32 n_fft=8192)
 
Buffer getFrequencyResponse (const uint32 n_fft=8192)
 
Buffer getImpulseResponse (const uint32 n_samples=8192)
 
virtual uint32 getKernelSize () const
 
Buffer getPhaseResponse ()
 
float64 getSampleRate () const
 
void plot (boolean show_phase=false)
 

Protected Types

typedef std::set< KernelKernelCache
 

Protected Member Functions

void makeKernel (const float64 &frequency1)
 

Protected Attributes

float64b_
 
float64window_
 
float64x_history_
 
float64x_ptr_
 
float64x_end_ptr_
 
float64 frequency_1_Hz_
 
KernelCache lp_cache_
 
float64 sample_rate_
 
float64 two_pi_over_sample_rate_
 
float64 sample_time_
 
uint32 kernel_size_
 
bool is_realtime_
 

Private Member Functions

 FilterLowPassFIR (const FilterLowPassFIR &copy)
 
FilterLowPassFIRoperator= (const FilterLowPassFIR &rhs)
 

Detailed Description

Definition at line 44 of file FilterLowPassFIR.h.

Member Typedef Documentation

typedef std::set<Kernel> Nsound::FilterLowPassFIR::KernelCache
protected

Definition at line 126 of file FilterLowPassFIR.h.

Constructor & Destructor Documentation

FilterLowPassFIR::FilterLowPassFIR ( const float64 sample_rate,
uint32  kernel_size,
const float64 cutoff_frequency_Hz 
)

Definition at line 48 of file FilterLowPassFIR.cc.

References Nsound::Filter::kernel_size_, M_PI, reset(), window_, x_end_ptr_, x_history_, and x_ptr_.

52  :
53  Filter(sample_rate),
54  b_(NULL),
55  window_(NULL),
56  x_history_(NULL),
57  x_ptr_(NULL),
58  x_end_ptr_(NULL),
59  frequency_1_Hz_(cutoff_frequency_Hz),
60  lp_cache_()
61 {
62  kernel_size_ = kernel_size;
63 
64  // Keep kernel_size_ odd.
65  if(kernel_size_ % 2 == 0)
66  {
67  ++kernel_size_;
68  }
69 
70  x_history_ = new float64[kernel_size_ + 1];
73 
74  // Create the Blackman window.
75  float64 ks = static_cast<float64>(kernel_size_);
77  for(uint32 i = 0; i < kernel_size_; ++i)
78  {
79  float64 di = static_cast<float64>(i);
80 
81  window_[i] = 0.420
82  - 0.500 * std::cos((di + 0.5) * 2.0 * M_PI / ks)
83  + 0.080 * std::cos((di + 0.5) * 4.0 * M_PI / ks);
84 
85  }
86 
88 }
unsigned int uint32
Definition: Nsound.h:153
#define M_PI
Definition: Nsound.h:121
double float64
Definition: Nsound.h:146
uint32 kernel_size_
Definition: Filter.h:116
Filter(const float64 &sample_rate)
Definition: Filter.cc:41
FilterLowPassFIR::~FilterLowPassFIR ( )
virtual

Definition at line 107 of file FilterLowPassFIR.cc.

References lp_cache_, window_, and x_history_.

108 {
109  delete [] window_;
110  delete [] x_history_;
111 
112  KernelCache::iterator itor = lp_cache_.begin();
113  KernelCache::iterator end = lp_cache_.end();
114 
115  while(itor != end)
116  {
117  delete [] itor->b_;
118  ++itor;
119  }
120 }
FilterLowPassFIR::FilterLowPassFIR ( const FilterLowPassFIR copy)
private

Definition at line 93 of file FilterLowPassFIR.cc.

94  :
95  Filter(copy.sample_rate_),
96  b_(NULL),
97  window_(NULL),
98  x_history_(NULL),
99  x_ptr_(NULL),
100  x_end_ptr_(NULL),
101  frequency_1_Hz_(0.0),
102  lp_cache_()
103 {}
Filter(const float64 &sample_rate)
Definition: Filter.cc:41
float64 sample_rate_
Definition: Filter.h:113

Member Function Documentation

AudioStream FilterLowPassFIR::filter ( const AudioStream x)

Definition at line 124 of file FilterLowPassFIR.cc.

References Nsound::Filter::filter().

Referenced by Nsound::FilterHighPassFIR::filter(), filter(), Nsound::FilterBandPassFIR::filter(), Nsound::FilterBandRejectFIR::filter(), and main().

125 {
126  return Filter::filter(x);
127 }
AudioStream filter(const AudioStream &x)
Definition: Filter.cc:53
AudioStream FilterLowPassFIR::filter ( const AudioStream x,
const float64 frequency 
)

Definition at line 131 of file FilterLowPassFIR.cc.

References Nsound::Filter::filter().

132 {
133  return Filter::filter(x, f);
134 }
AudioStream filter(const AudioStream &x)
Definition: Filter.cc:53
AudioStream FilterLowPassFIR::filter ( const AudioStream x,
const Buffer frequencies 
)

Definition at line 138 of file FilterLowPassFIR.cc.

References Nsound::Filter::filter().

139 {
140  return Filter::filter(x, frequencies);
141 }
AudioStream filter(const AudioStream &x)
Definition: Filter.cc:53
Buffer FilterLowPassFIR::filter ( const Buffer x)

Definition at line 145 of file FilterLowPassFIR.cc.

References Nsound::Filter::filter().

146 {
147  return Filter::filter(x);
148 }
AudioStream filter(const AudioStream &x)
Definition: Filter.cc:53
Buffer FilterLowPassFIR::filter ( const Buffer x,
const float64 frequency 
)

Definition at line 152 of file FilterLowPassFIR.cc.

References Nsound::Buffer::begin(), Nsound::Buffer::end(), filter(), Nsound::Buffer::getLength(), makeKernel(), and reset().

153 {
154  // Instead of calling Filter::filter(x,f), we implement this function here
155  // to avoid calling makeKernel(f) for each sample.
156 
157  reset();
158  makeKernel(f);
159 
160  Buffer::const_iterator itor = x.begin();
161  Buffer::const_iterator end = x.end();
162 
163  Buffer y(x.getLength());
164  while(itor != end)
165  {
166  y << FilterLowPassFIR::filter(*itor);
167  ++itor;
168  }
169 
170  return y;
171 }
uint32 getLength() const
Returns the number of samples in the Buffer.
Definition: Buffer.h:587
void makeKernel(const float64 &frequency1)
iterator end()
Retruns the itreator at the end of the Buffer.
Definition: Buffer.h:348
FloatVector::const_iterator const_iterator
Definition: Buffer.h:70
iterator begin()
Retruns the itreator at the start of the Buffer.
Definition: Buffer.h:285
A Buffer for storing audio samples.
Definition: Buffer.h:60
AudioStream filter(const AudioStream &x)
Buffer FilterLowPassFIR::filter ( const Buffer x,
const Buffer frequencies 
)

Definition at line 175 of file FilterLowPassFIR.cc.

References Nsound::Filter::filter().

176 {
177  return Filter::filter(x, frequencies);
178 }
AudioStream filter(const AudioStream &x)
Definition: Filter.cc:53
float64 FilterLowPassFIR::filter ( const float64 x)
virtual

Implements Nsound::Filter.

Reimplemented in Nsound::FilterBandRejectFIR, and Nsound::FilterHighPassFIR.

Definition at line 182 of file FilterLowPassFIR.cc.

References b_, Nsound::Filter::kernel_size_, x_end_ptr_, x_history_, and x_ptr_.

183 {
184  // Write x to history
185  *x_ptr_ = x;
186 
187  // Increment history pointer
188  ++x_ptr_;
189 
190  // Bounds check.
191  if(x_ptr_ >= x_end_ptr_)
192  {
193  x_ptr_ = x_history_;
194  }
195 
196  // Perform the convolution.
197 
198  // y[n] = kernel_[0] * x[n]
199  // + kernel_[1] * x[n - 1]
200  // + kernel_[2] * x[n - 2]
201  // ...
202  // + kernel_[N] * x[n - N]
203 
204  float64 y = 0.0;
205  float64 * history = x_ptr_;
206  for(float64 * b = b_; b != b_ + kernel_size_; ++b)
207  {
208  // When we enter this loop, history is pointing at x[n + 1].
209  --history;
210 
211  // Bounds check
212  if(history < x_history_)
213  {
214  history = x_end_ptr_ - 1;
215  }
216 
217  y += *b * *history;
218  }
219 
220  return y;
221 }
double float64
Definition: Nsound.h:146
uint32 kernel_size_
Definition: Filter.h:116
float64 FilterLowPassFIR::filter ( const float64 x,
const float64 frequency_Hz 
)
virtual

Implements Nsound::Filter.

Definition at line 225 of file FilterLowPassFIR.cc.

References filter(), and makeKernel().

226 {
227  FilterLowPassFIR::makeKernel(frequency_Hz);
228  return filter(x);
229 }
void makeKernel(const float64 &frequency1)
AudioStream filter(const AudioStream &x)
float64 Nsound::FilterLowPassFIR::getFrequency ( ) const
inline
Buffer FilterLowPassFIR::getImpulseResponse ( )

Definition at line 233 of file FilterLowPassFIR.cc.

References Nsound::Filter::getImpulseResponse().

234 {
236 }
Buffer getImpulseResponse(const uint32 n_samples=8192)
Definition: Filter.cc:225
void FilterLowPassFIR::plot ( boolean  show_fc = true,
boolean  show_phase = false 
)

Definition at line 240 of file FilterLowPassFIR.cc.

References Nsound::Plotter::axvline(), frequency_1_Hz_, Nsound::Filter::kernel_size_, Nsound::Filter::plot(), Nsound::Filter::sample_rate_, Nsound::Plotter::subplot(), and Nsound::Plotter::title().

Referenced by main().

241 {
242  char title[256];
243  sprintf(title,
244  "Low Pass FIR Frequency Response\n"
245  "order = %d, fc = %0.1f Hz, sr = %0.1f Hz",
247 
248  Filter::plot(show_phase);
249 
250  Plotter pylab;
251 
252  uint32 n_rows = 1;
253 
254  if(show_phase)
255  {
256  n_rows = 2;
257  }
258 
259  if(show_fc)
260  {
261  pylab.subplot(n_rows, 1, 1);
262 
263  pylab.axvline(frequency_1_Hz_,"color='red'");
264 
265  pylab.title(title);
266  }
267 }
unsigned int uint32
Definition: Nsound.h:153
void axvline(const float64 &x_pos=0.0, const std::string &kwargs="")
Draws a vertical line at x and spans ymin to ymax (ralitive).
Definition: Plotter.cc:358
void title(const std::string &title, const std::string &kwargs="")
Add a title to the plot at the top and centered.
Definition: Plotter.cc:1127
Axes subplot(const uint32 n_rows, const uint32 n_cols, const uint32 n, const std::string &kwargs="", Axes *sharex=NULL, Axes *sharey=NULL)
Creates a figure in a subplot, subplot(A, B, C, **kwargs)
Definition: Plotter.cc:1031
uint32 kernel_size_
Definition: Filter.h:116
void plot(boolean show_phase=false)
Definition: Filter.cc:262
float64 sample_rate_
Definition: Filter.h:113
void FilterLowPassFIR::reset ( )
virtual

Resets interal history buffer and sets the cut off frequency to the one used at declaration.

Implements Nsound::Filter.

Definition at line 356 of file FilterLowPassFIR.cc.

References frequency_1_Hz_, Nsound::Filter::kernel_size_, makeKernel(), x_history_, and x_ptr_.

Referenced by filter(), FilterLowPassFIR(), Nsound::FilterBandPassFIR::reset(), Nsound::FilterBandRejectFIR::reset(), and setCutoff().

357 {
358  memset(x_history_, 0, sizeof(float64) * (kernel_size_ + 1));
359  x_ptr_ = x_history_;
360 
362 }
double float64
Definition: Nsound.h:146
void makeKernel(const float64 &frequency1)
uint32 kernel_size_
Definition: Filter.h:116
void FilterLowPassFIR::setCutoff ( const float64 fc)

Sets the cut off frequency (Hz).

Definition at line 366 of file FilterLowPassFIR.cc.

References frequency_1_Hz_, and reset().

367 {
368  frequency_1_Hz_ = fc;
369  reset();
370 }
void FilterLowPassFIR::makeKernel ( const float64 frequency1)
protected

Definition at line 271 of file FilterLowPassFIR.cc.

References b_, Nsound::Filter::kernel_size_, lp_cache_, Nsound::Filter::two_pi_over_sample_rate_, and window_.

Referenced by filter(), Nsound::FilterHighPassFIR::makeKernel(), Nsound::FilterBandRejectFIR::makeKernel(), and reset().

272 {
273  // Here we create a key into the kernel cache. I'm only storing kernels
274  // with freqs chopped off to the 10th Hz. So filtering with a kernel
275  // designed at 440.1567 Hz will get stored as 440.1. Any other frequency
276  // that starts at 440.1 will not get a kernel calculated and just use the
277  // one in the cache. So the max diff between what's passed in and what's
278  // stored in the cache is 0.09999 Hz.
279 
281  Kernel new_kernel(
282  static_cast<uint32>(cutoff_frequency_Hz));
283 
284  // See if the kernel is in the cache.
285  KernelCache::const_iterator itor = lp_cache_.find(new_kernel);
286 
287  if(itor != lp_cache_.end())
288  {
289  // The kernel was found in the cache.
290  b_ = itor->b_;
291  return;
292  }
293 
294  // The filter wasn't in the cache, need to make it.
295  new_kernel.b_ = new float64[kernel_size_];
296 
297  // Makes a Windowed-sinc filter with cutoff frequency specified.
298  //
299  // DSP: A Practical Guide for Engineers and Scientists
300  //
301  // ISBN-13: 978-0-7506-7444-7
302  //
303  // Equation 16-4
304 
305  const float64 ks = static_cast<float64>(kernel_size_);
306 
307  const float64 omega = two_pi_over_sample_rate_ * cutoff_frequency_Hz;
308 
309  // cut off of zero Hz!
310  if(cutoff_frequency_Hz < 0.10)
311  {
312  // Create no pass filter.
313  memset(new_kernel.b_, 0, kernel_size_ * sizeof(float64));
314  }
315  else
316  {
317  float64 sum = 0.0;
318 
319  float64 ks_2 = ks / 2.0;
320 
321  float64 * b = new_kernel.b_;
322  float64 * w = window_;
323  for(float64 i = 0.0; i < ks; i += 1.0)
324  {
325  float64 x = i - ks_2 + 1e-16;
326 
327  *b = std::sin(omega * x) / x * *w;
328 
329  sum += *b;
330 
331  ++b;
332  ++w;
333  }
334 
335  // Normalize kernel.
336  for(float64 * b = new_kernel.b_; b < new_kernel.b_ + kernel_size_; ++b)
337  {
338  *b /= sum;
339  }
340  }
341 
342  // Point to the new kernel.
343  b_ = new_kernel.b_;
344 
345  // Add the new kernel to the cache.
346  lp_cache_.insert(new_kernel);
347 
348 //~ for(int i = 0; i < kernel_size_; ++i)
349 //~ {
350 //~ cerr << "b_[" << i + 1 << "] = " << b_[i] << endl;
351 //~ }
352 }
double float64
Definition: Nsound.h:146
uint32 kernel_size_
Definition: Filter.h:116
A class to store calculated kernels.
float64 two_pi_over_sample_rate_
Definition: Filter.h:114
FilterLowPassFIR& Nsound::FilterLowPassFIR::operator= ( const FilterLowPassFIR rhs)
inlineprivate

Definition at line 135 of file FilterLowPassFIR.h.

135 {return *this;};
void Nsound::Filter::setRealtime ( bool  flag)
inlineinherited

Definition at line 57 of file Filter.h.

References Nsound::Filter::is_realtime_.

57 {is_realtime_ = flag;}
bool is_realtime_
Definition: Filter.h:118
Buffer Filter::getFrequencyAxis ( const uint32  n_fft = 8192)
inherited

Definition at line 185 of file Filter.cc.

References Nsound::FFTransform::roundUp2(), and Nsound::Filter::sample_rate_.

Referenced by main(), Nsound::Filter::plot(), and Nsound::FilterIIR::savePlot().

186 {
187  uint32 fft_chunk_size = FFTransform::roundUp2(
188  static_cast<int32>(n_fft));
189 
190  uint32 n_samples = fft_chunk_size / 2 + 1;
191 
192  float64 f_step = (1.0 / (static_cast<float64>(fft_chunk_size) / 2.0))
193  * (sample_rate_ / 2.0);
194 
195  Buffer f_axis;
196 
197  float64 f = 0.0;
198 
199  for(uint32 i = 0; i < n_samples; ++i)
200  {
201  f_axis << f;
202  f += f_step;
203  }
204 
205  return f_axis;
206 };
unsigned int uint32
Definition: Nsound.h:153
double float64
Definition: Nsound.h:146
static int32 roundUp2(int32 raw)
Returns nearest power of 2 >= raw.
Definition: FFTransform.cc:274
A Buffer for storing audio samples.
Definition: Buffer.h:60
float64 sample_rate_
Definition: Filter.h:113
Buffer Filter::getFrequencyResponse ( const uint32  n_fft = 8192)
inherited

Definition at line 210 of file Filter.cc.

References Nsound::FFTransform::fft(), Nsound::Filter::getImpulseResponse(), and Nsound::Filter::sample_rate_.

Referenced by Nsound::FilterBandPassIIR::FilterBandPassIIR(), FilterLeastSquaresFIR_UnitTest(), Nsound::FilterIIR::getRMS(), main(), Nsound::Filter::plot(), and Nsound::FilterIIR::savePlot().

211 {
213 
214 //~ fft.setWindow(HANNING);
215 
216  FFTChunkVector vec;
217 
218  vec = fft.fft(getImpulseResponse(), n_fft);
219 
220  return vec[0].getMagnitude();
221 }
Buffer getImpulseResponse(const uint32 n_samples=8192)
Definition: Filter.cc:225
A Class that performes the Fast Fouier Transfrom on a Buffer.
Definition: FFTransform.h:57
std::vector< FFTChunk > FFTChunkVector
Definition: FFTChunk.h:119
float64 sample_rate_
Definition: Filter.h:113
Buffer Filter::getImpulseResponse ( const uint32  n_samples = 8192)
inherited

Definition at line 225 of file Filter.cc.

References Nsound::Filter::filter(), Nsound::Filter::is_realtime_, and Nsound::Filter::reset().

Referenced by Nsound::Filter::getFrequencyResponse(), Nsound::FilterHighPassFIR::getImpulseResponse(), getImpulseResponse(), Nsound::FilterLeastSquaresFIR::getImpulseResponse(), Nsound::FilterIIR::getImpulseResponse(), and Nsound::Filter::getPhaseResponse().

226 {
227  if(!is_realtime_) reset();
228 
229  Buffer response(n_samples);
230 
231  response << filter(1.0);
232 
233  for(uint32 i = 1; i < n_samples; ++i)
234  {
235  response << filter(0.0);
236  }
237 
238  if(!is_realtime_) reset();
239 
240  return response;
241 }
unsigned int uint32
Definition: Nsound.h:153
virtual void reset()=0
AudioStream filter(const AudioStream &x)
Definition: Filter.cc:53
bool is_realtime_
Definition: Filter.h:118
A Buffer for storing audio samples.
Definition: Buffer.h:60
virtual uint32 Nsound::Filter::getKernelSize ( ) const
inlinevirtualinherited
Buffer Filter::getPhaseResponse ( )
inherited

Definition at line 245 of file Filter.cc.

References Nsound::FFTransform::fft(), Nsound::Filter::getImpulseResponse(), Nsound::Buffer::getLength(), Nsound::Filter::sample_rate_, and Nsound::Buffer::subbuffer().

Referenced by Nsound::Filter::plot().

246 {
247  uint32 n_samples = static_cast<uint32>(sample_rate_ * 2);
248 
249  FFTransform fft(n_samples);
250 
251  FFTChunkVector vec;
252 
253  vec = fft.fft(getImpulseResponse(), n_samples);
254 
255  Buffer phase = vec[0].getPhase();
256 
257  return phase.subbuffer(0, phase.getLength() / 2 + 1);
258 }
Buffer subbuffer(uint32 start_index, uint32 n_samples=0) const
Slice the Buffer.
Definition: Buffer.cc:2073
unsigned int uint32
Definition: Nsound.h:153
uint32 getLength() const
Returns the number of samples in the Buffer.
Definition: Buffer.h:587
Buffer getImpulseResponse(const uint32 n_samples=8192)
Definition: Filter.cc:225
A Class that performes the Fast Fouier Transfrom on a Buffer.
Definition: FFTransform.h:57
A Buffer for storing audio samples.
Definition: Buffer.h:60
std::vector< FFTChunk > FFTChunkVector
Definition: FFTChunk.h:119
float64 sample_rate_
Definition: Filter.h:113
float64 Nsound::Filter::getSampleRate ( ) const
inlineinherited

Definition at line 102 of file Filter.h.

References Nsound::Filter::sample_rate_.

102 { return sample_rate_; };
float64 sample_rate_
Definition: Filter.h:113
void Filter::plot ( boolean  show_phase = false)
inherited

Definition at line 262 of file Filter.cc.

References Nsound::Plotter::figure(), Nsound::Buffer::getdB(), Nsound::Filter::getFrequencyAxis(), Nsound::Filter::getFrequencyResponse(), Nsound::Buffer::getMax(), Nsound::Filter::getPhaseResponse(), Nsound::Plotter::plot(), Nsound::Plotter::subplot(), Nsound::Plotter::xlabel(), Nsound::Plotter::ylabel(), and Nsound::Plotter::ylim().

Referenced by main(), Nsound::FilterLowPassMoogVcf::plot(), Nsound::FilterPhaser::plot(), Nsound::FilterTone::plot(), Nsound::FilterHighPassIIR::plot(), Nsound::FilterCombLowPassFeedback::plot(), Nsound::FilterLowPassIIR::plot(), plot(), Nsound::FilterHighPassFIR::plot(), Nsound::FilterAllPass::plot(), Nsound::FilterBandPassVocoder::plot(), Nsound::FilterBandPassFIR::plot(), Nsound::FilterLeastSquaresFIR::plot(), Nsound::FilterFlanger::plot(), Nsound::FilterBandRejectFIR::plot(), Nsound::FilterBandPassIIR::plot(), Nsound::FilterBandRejectIIR::plot(), and Nsound::FilterParametricEqualizer::plot().

263 {
264  Buffer x = getFrequencyAxis();
266 
267  Plotter pylab;
268 
269  pylab.figure();
270 
271  uint32 n_rows = 1;
272  uint32 n_cols = 1;
273 
274  if(show_phase)
275  {
276  n_rows = 2;
277  }
278 
279  pylab.subplot(n_rows, n_cols, 1);
280 
281  // Frequency response
282  pylab.plot(x,fr, "blue");
283 
284  pylab.xlabel("Frequency (Hz)");
285  pylab.ylabel("Frequency Response (dB)");
286 
287  // Phase response
288  if(show_phase)
289  {
290  pylab.subplot(n_rows, n_cols, 2);
291 
292  Buffer pr = getPhaseResponse().getdB();
293 
294  pylab.plot(x,pr);
295 
296  pylab.xlabel("Frequency (Hz)");
297  pylab.ylabel("Phase Response (dB)");
298  }
299 
300  float64 ymax = fr.getMax();
301  float64 height = ymax - -60.0;
302 
303  pylab.ylim(-60.0, ymax + 0.05 * height);
304 }
unsigned int uint32
Definition: Nsound.h:153
void xlabel(const std::string &label, const std::string &kwargs="")
Add a label x axis.
Definition: Plotter.cc:1154
void plot(const Buffer &y, const std::string &fmt="", const std::string &kwargs="")
Plots the Buffer on the current figure.
Definition: Plotter.cc:765
void figure(const std::string &kwargs="") const
Creates a new figure window to plot in.
Definition: Plotter.cc:455
Buffer getPhaseResponse()
Definition: Filter.cc:245
double float64
Definition: Nsound.h:146
Axes subplot(const uint32 n_rows, const uint32 n_cols, const uint32 n, const std::string &kwargs="", Axes *sharex=NULL, Axes *sharey=NULL)
Creates a figure in a subplot, subplot(A, B, C, **kwargs)
Definition: Plotter.cc:1031
void ylim(const float64 &ymin, const float64 &ymax)
Definition: Plotter.cc:422
Buffer getFrequencyAxis(const uint32 n_fft=8192)
Definition: Filter.cc:185
void ylabel(const std::string &label, const std::string &kwargs="")
Add a label y axis.
Definition: Plotter.cc:1180
A Buffer for storing audio samples.
Definition: Buffer.h:60
Buffer getFrequencyResponse(const uint32 n_fft=8192)
Definition: Filter.cc:210
float64 getMax() const
Returns the maximum sample value in the Buffer.
Definition: Buffer.cc:951
Buffer getdB() const
Returns the Buffer in dB.
Definition: Buffer.h:487

Member Data Documentation

float64* Nsound::FilterLowPassFIR::b_
protected
float64* Nsound::FilterLowPassFIR::window_
protected

Definition at line 105 of file FilterLowPassFIR.h.

Referenced by FilterLowPassFIR(), makeKernel(), and ~FilterLowPassFIR().

float64* Nsound::FilterLowPassFIR::x_history_
protected
float64* Nsound::FilterLowPassFIR::x_ptr_
protected
float64* Nsound::FilterLowPassFIR::x_end_ptr_
protected

Definition at line 110 of file FilterLowPassFIR.h.

Referenced by filter(), and FilterLowPassFIR().

float64 Nsound::FilterLowPassFIR::frequency_1_Hz_
protected
KernelCache Nsound::FilterLowPassFIR::lp_cache_
protected

Definition at line 128 of file FilterLowPassFIR.h.

Referenced by makeKernel(), and ~FilterLowPassFIR().

float64 Nsound::Filter::sample_rate_
protectedinherited

Definition at line 113 of file Filter.h.

Referenced by Nsound::FilterPhaser::filter(), Nsound::FilterCombLowPassFeedback::filter(), Nsound::FilterDelay::filter(), Nsound::FilterAllPass::FilterAllPass(), Nsound::FilterCombLowPassFeedback::FilterCombLowPassFeedback(), Nsound::FilterDelay::FilterDelay(), Nsound::FilterFlanger::FilterFlanger(), Nsound::FilterPhaser::FilterPhaser(), Nsound::FilterSlinky::FilterSlinky(), Nsound::Filter::getFrequencyAxis(), Nsound::Filter::getFrequencyResponse(), Nsound::Filter::getPhaseResponse(), Nsound::Filter::getSampleRate(), Nsound::FilterStageIIR::makeIIRKernelHelper(), Nsound::FilterHighPassFIR::makeKernel(), Nsound::FilterStageIIR::makeKernel(), Nsound::FilterBandPassVocoder::makeKernel(), Nsound::FilterLeastSquaresFIR::makeKernel(), Nsound::FilterParametricEqualizer::makeKernel(), Nsound::FilterPhaser::operator=(), Nsound::FilterLeastSquaresFIR::operator=(), Nsound::FilterFlanger::operator=(), Nsound::FilterIIR::operator=(), Nsound::FilterLowPassMoogVcf::plot(), Nsound::FilterPhaser::plot(), Nsound::FilterTone::plot(), Nsound::FilterHighPassIIR::plot(), Nsound::FilterLowPassIIR::plot(), Nsound::FilterCombLowPassFeedback::plot(), plot(), Nsound::FilterHighPassFIR::plot(), Nsound::FilterAllPass::plot(), Nsound::FilterBandPassFIR::plot(), Nsound::FilterLeastSquaresFIR::plot(), Nsound::FilterFlanger::plot(), Nsound::FilterBandRejectFIR::plot(), Nsound::FilterBandRejectIIR::plot(), Nsound::FilterBandPassIIR::plot(), Nsound::FilterParametricEqualizer::plot(), Nsound::FilterLowPassIIR::setCutoff(), and Nsound::FilterLeastSquaresFIR::setWindow().

float64 Nsound::Filter::two_pi_over_sample_rate_
protectedinherited
float64 Nsound::Filter::sample_time_
protectedinherited

Definition at line 115 of file Filter.h.

Referenced by Nsound::FilterLowPassMoogVcf::_make_filter().

uint32 Nsound::Filter::kernel_size_
protectedinherited
bool Nsound::Filter::is_realtime_
protectedinherited

The documentation for this class was generated from the following files: