Nsound
0.9.4
|
A class for filtering audio in the frequecy domain. More...
#include <Nsound/FilterStageIIR.h>
Classes | |
struct | Kernel |
A class to store calculated kernels. More... | |
Public Types | |
enum | Type { LOW_PASS, HIGH_PASS } |
Public Member Functions | |
FilterStageIIR (Type type, const float64 &sample_rate, uint32 n_poles, const float64 &frequency, const float64 &percent_ripple) | |
FilterStageIIR (const FilterStageIIR ©) | |
virtual | ~FilterStageIIR () |
AudioStream | filter (const AudioStream &x) |
AudioStream | filter (const AudioStream &x, const float64 &f) |
AudioStream | filter (const AudioStream &x, const Buffer &frequencies) |
Buffer | filter (const Buffer &x) |
Buffer | filter (const Buffer &x, const float64 &f) |
Buffer | filter (const Buffer &x, const Buffer &frequencies) |
float64 | filter (const float64 &x) |
float64 | filter (const float64 &x, const float64 &frequency) |
void | makeKernel (const float64 &frequency) |
FilterStageIIR & | operator= (const FilterStageIIR &rhs) |
void | reset () |
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< Kernel > | KernelCache |
Protected Member Functions | |
void | makeIIRKernelHelper (const float64 &frequency, float64 *a, float64 *b, uint32 p) |
Protected Attributes | |
Type | type_ |
uint32 | n_poles_ |
float64 | frequency_ |
float64 | percent_ripple_ |
float64 * | a_ |
float64 * | b_ |
float64 * | x_history_ |
float64 * | x_ptr_ |
float64 * | x_end_ptr_ |
float64 * | y_history_ |
float64 * | y_ptr_ |
float64 * | y_end_ptr_ |
KernelCache | kernel_cache_ |
float64 | sample_rate_ |
float64 | two_pi_over_sample_rate_ |
float64 | sample_time_ |
uint32 | kernel_size_ |
bool | is_realtime_ |
A class for filtering audio in the frequecy domain.
Definition at line 49 of file FilterStageIIR.h.
|
protected |
Definition at line 141 of file FilterStageIIR.h.
FilterStageIIR::FilterStageIIR | ( | Type | type, |
const float64 & | sample_rate, | ||
uint32 | n_poles, | ||
const float64 & | frequency, | ||
const float64 & | percent_ripple | ||
) |
Definition at line 44 of file FilterStageIIR.cc.
References n_poles_, reset(), x_end_ptr_, x_history_, x_ptr_, y_end_ptr_, y_history_, and y_ptr_.
FilterStageIIR::FilterStageIIR | ( | const FilterStageIIR & | copy | ) |
Definition at line 93 of file FilterStageIIR.cc.
|
virtual |
Definition at line 115 of file FilterStageIIR.cc.
References kernel_cache_, x_history_, and y_history_.
AudioStream FilterStageIIR::filter | ( | const AudioStream & | x | ) |
Definition at line 133 of file FilterStageIIR.cc.
References Nsound::Filter::filter().
Referenced by Nsound::FilterHighPassIIR::filter(), Nsound::FilterLowPassIIR::filter(), and filter().
AudioStream FilterStageIIR::filter | ( | const AudioStream & | x, |
const float64 & | f | ||
) |
AudioStream FilterStageIIR::filter | ( | const AudioStream & | x, |
const Buffer & | frequencies | ||
) |
Definition at line 162 of file FilterStageIIR.cc.
References Nsound::Buffer::begin(), Nsound::Buffer::end(), filter(), Nsound::Buffer::getLength(), makeKernel(), and reset().
Implements Nsound::Filter.
Definition at line 271 of file FilterStageIIR.cc.
References a_, b_, n_poles_, x_end_ptr_, x_history_, x_ptr_, y_end_ptr_, y_history_, and y_ptr_.
Implements Nsound::Filter.
Definition at line 334 of file FilterStageIIR.cc.
References filter(), and makeKernel().
void FilterStageIIR::makeKernel | ( | const float64 & | frequency | ) |
Definition at line 342 of file FilterStageIIR.cc.
References a_, b_, HIGH_PASS, kernel_cache_, LOW_PASS, makeIIRKernelHelper(), n_poles_, Nsound::Filter::sample_rate_, and type_.
Referenced by filter(), Nsound::FilterHighPassIIR::makeKernel(), Nsound::FilterLowPassIIR::makeKernel(), and reset().
FilterStageIIR & FilterStageIIR::operator= | ( | const FilterStageIIR & | rhs | ) |
Definition at line 195 of file FilterStageIIR.cc.
References Nsound::FilterStageIIR::Kernel::a_, Nsound::FilterStageIIR::Kernel::b_, frequency_, kernel_cache_, n_poles_, percent_ripple_, reset(), type_, x_end_ptr_, x_history_, x_ptr_, y_end_ptr_, y_history_, and y_ptr_.
|
virtual |
Implements Nsound::Filter.
Definition at line 258 of file FilterStageIIR.cc.
References frequency_, makeKernel(), n_poles_, x_history_, x_ptr_, y_history_, and y_ptr_.
Referenced by filter(), FilterStageIIR(), operator=(), Nsound::FilterHighPassIIR::reset(), and Nsound::FilterLowPassIIR::reset().
|
protected |
Definition at line 474 of file FilterStageIIR.cc.
References HIGH_PASS, LOW_PASS, M_PI, n_poles_, percent_ripple_, Nsound::Filter::sample_rate_, and type_.
Referenced by makeKernel().
|
inlineinherited |
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().
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().
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(), Nsound::FilterLowPassFIR::getImpulseResponse(), Nsound::FilterLeastSquaresFIR::getImpulseResponse(), Nsound::FilterIIR::getImpulseResponse(), and Nsound::Filter::getPhaseResponse().
|
inlinevirtualinherited |
Reimplemented in Nsound::FilterIIR, and Nsound::FilterTone.
Definition at line 96 of file Filter.h.
References Nsound::Filter::kernel_size_.
Referenced by Nsound::FilterBandPassIIR::FilterBandPassIIR(), Nsound::FilterBandPassFIR::plot(), Nsound::FilterBandPassIIR::plot(), and Nsound::FilterBandRejectIIR::plot().
|
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().
|
inlineinherited |
|
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(), Nsound::FilterLowPassFIR::plot(), Nsound::FilterHighPassFIR::plot(), Nsound::FilterAllPass::plot(), Nsound::FilterBandPassVocoder::plot(), Nsound::FilterBandPassFIR::plot(), Nsound::FilterLeastSquaresFIR::plot(), Nsound::FilterFlanger::plot(), Nsound::FilterBandRejectFIR::plot(), Nsound::FilterBandRejectIIR::plot(), Nsound::FilterBandPassIIR::plot(), and Nsound::FilterParametricEqualizer::plot().
|
protected |
Definition at line 112 of file FilterStageIIR.h.
Referenced by makeIIRKernelHelper(), makeKernel(), and operator=().
|
protected |
Definition at line 113 of file FilterStageIIR.h.
Referenced by filter(), FilterStageIIR(), makeIIRKernelHelper(), makeKernel(), operator=(), Nsound::FilterHighPassIIR::plot(), Nsound::FilterLowPassIIR::plot(), and reset().
|
protected |
Definition at line 114 of file FilterStageIIR.h.
Referenced by Nsound::FilterHighPassIIR::FilterHighPassIIR(), Nsound::FilterLowPassIIR::FilterLowPassIIR(), Nsound::FilterHighPassIIR::getFrequency(), Nsound::FilterLowPassIIR::getFrequency(), Nsound::FilterStageIIR::Kernel::operator<(), operator=(), Nsound::FilterHighPassIIR::plot(), Nsound::FilterLowPassIIR::plot(), reset(), and Nsound::FilterLowPassIIR::setCutoff().
|
protected |
Definition at line 115 of file FilterStageIIR.h.
Referenced by makeIIRKernelHelper(), and operator=().
|
protected |
Definition at line 117 of file FilterStageIIR.h.
Referenced by filter(), and makeKernel().
|
protected |
Definition at line 118 of file FilterStageIIR.h.
Referenced by filter(), and makeKernel().
|
protected |
Definition at line 120 of file FilterStageIIR.h.
Referenced by filter(), FilterStageIIR(), operator=(), reset(), and ~FilterStageIIR().
|
protected |
Definition at line 121 of file FilterStageIIR.h.
Referenced by filter(), FilterStageIIR(), operator=(), and reset().
|
protected |
Definition at line 122 of file FilterStageIIR.h.
Referenced by filter(), FilterStageIIR(), and operator=().
|
protected |
Definition at line 124 of file FilterStageIIR.h.
Referenced by filter(), FilterStageIIR(), operator=(), reset(), and ~FilterStageIIR().
|
protected |
Definition at line 125 of file FilterStageIIR.h.
Referenced by filter(), FilterStageIIR(), operator=(), and reset().
|
protected |
Definition at line 126 of file FilterStageIIR.h.
Referenced by filter(), FilterStageIIR(), and operator=().
|
protected |
Definition at line 143 of file FilterStageIIR.h.
Referenced by makeKernel(), operator=(), and ~FilterStageIIR().
|
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(), makeIIRKernelHelper(), Nsound::FilterHighPassFIR::makeKernel(), 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::FilterCombLowPassFeedback::plot(), Nsound::FilterLowPassIIR::plot(), Nsound::FilterLowPassFIR::plot(), Nsound::FilterAllPass::plot(), Nsound::FilterHighPassFIR::plot(), Nsound::FilterBandPassFIR::plot(), Nsound::FilterLeastSquaresFIR::plot(), Nsound::FilterFlanger::plot(), Nsound::FilterBandRejectFIR::plot(), Nsound::FilterBandPassIIR::plot(), Nsound::FilterBandRejectIIR::plot(), Nsound::FilterParametricEqualizer::plot(), Nsound::FilterLowPassIIR::setCutoff(), and Nsound::FilterLeastSquaresFIR::setWindow().
|
protectedinherited |
Definition at line 114 of file Filter.h.
Referenced by Nsound::FilterTone::makeKernel(), Nsound::FilterLowPassFIR::makeKernel(), and Nsound::FilterParametricEqualizer::makeKernel().
|
protectedinherited |
Definition at line 115 of file Filter.h.
Referenced by Nsound::FilterLowPassMoogVcf::_make_filter().
|
protectedinherited |
Definition at line 116 of file Filter.h.
Referenced by Nsound::FilterLowPassFIR::filter(), Nsound::FilterLeastSquaresFIR::filter(), Nsound::FilterBandPassFIR::FilterBandPassFIR(), Nsound::FilterBandPassIIR::FilterBandPassIIR(), Nsound::FilterBandRejectIIR::FilterBandRejectIIR(), Nsound::FilterHighPassIIR::FilterHighPassIIR(), Nsound::FilterLeastSquaresFIR::FilterLeastSquaresFIR(), Nsound::FilterLowPassFIR::FilterLowPassFIR(), Nsound::FilterLowPassIIR::FilterLowPassIIR(), Nsound::FilterLeastSquaresFIR::getKernel(), Nsound::Filter::getKernelSize(), Nsound::FilterHighPassFIR::makeKernel(), Nsound::FilterLowPassFIR::makeKernel(), Nsound::FilterBandRejectFIR::makeKernel(), Nsound::FilterLeastSquaresFIR::makeKernel(), Nsound::FilterLeastSquaresFIR::operator=(), Nsound::FilterLowPassFIR::plot(), Nsound::FilterHighPassFIR::plot(), Nsound::FilterLeastSquaresFIR::plot(), Nsound::FilterBandRejectFIR::plot(), Nsound::FilterLowPassFIR::reset(), Nsound::FilterHighPassFIR::reset(), Nsound::FilterLeastSquaresFIR::reset(), Nsound::FilterLeastSquaresFIR::setKernel(), Nsound::FilterLeastSquaresFIR::setWindow(), and Nsound::FilterHighPassFIR::spectraReversal_().
|
protectedinherited |
Definition at line 118 of file Filter.h.
Referenced by Nsound::Filter::filter(), Nsound::FilterBandRejectIIR::filter(), Nsound::FilterBandRejectFIR::filter(), Nsound::Filter::getImpulseResponse(), and Nsound::Filter::setRealtime().