Nsound
0.9.4
|
A FIR filter that is defined as the least square error to the desired requency response. More...
#include <Nsound/FilterLeastSquaresFIR.h>
Protected Attributes | |
float64 * | b_ |
float64 * | window_ |
float64 * | x_history_ |
float64 * | x_ptr_ |
float64 * | x_end_ptr_ |
Buffer * | f_axis_ |
Buffer * | a_axis_ |
float64 | sample_rate_ |
float64 | two_pi_over_sample_rate_ |
float64 | sample_time_ |
uint32 | kernel_size_ |
bool | is_realtime_ |
A FIR filter that is defined as the least square error to the desired requency response.
Based on Matlab's firls function.
Definition at line 48 of file FilterLeastSquaresFIR.h.
FilterLeastSquaresFIR::FilterLeastSquaresFIR | ( | const float64 & | sample_rate, |
uint32 | kernel_size, | ||
const Buffer & | freq_axis, | ||
const Buffer & | amplitude_axis, | ||
const float64 & | beta = 5.0 |
||
) |
Definition at line 51 of file FilterLeastSquaresFIR.cc.
References a_axis_, b_, Nsound::Generator::drawWindowKaiser(), f_axis_, Nsound::Buffer::getPointer(), Nsound::Filter::kernel_size_, makeKernel(), reset(), window_, x_end_ptr_, x_history_, and x_ptr_.
FilterLeastSquaresFIR::FilterLeastSquaresFIR | ( | const FilterLeastSquaresFIR & | copy | ) |
Definition at line 95 of file FilterLeastSquaresFIR.cc.
References a_axis_, b_, f_axis_, Nsound::Filter::kernel_size_, window_, x_end_ptr_, x_history_, and x_ptr_.
|
virtual |
Definition at line 127 of file FilterLeastSquaresFIR.cc.
References a_axis_, b_, f_axis_, window_, and x_history_.
Buffer FilterLeastSquaresFIR::getKernel | ( | ) | const |
Definition at line 138 of file FilterLeastSquaresFIR.cc.
References b_, and Nsound::Filter::kernel_size_.
Referenced by Nsound::Buffer::_get_resample().
void FilterLeastSquaresFIR::setKernel | ( | const Buffer & | k | ) |
Definition at line 151 of file FilterLeastSquaresFIR.cc.
References b_, Nsound::Generator::drawWindowKaiser(), Nsound::Buffer::getLength(), Nsound::Buffer::getPointer(), Nsound::Filter::kernel_size_, reset(), window_, x_end_ptr_, x_history_, and x_ptr_.
Referenced by Nsound::Buffer::_get_resample().
Buffer FilterLeastSquaresFIR::getKernelFrequencies | ( | ) |
Buffer FilterLeastSquaresFIR::getKernelAmplitudes | ( | ) |
AudioStream FilterLeastSquaresFIR::filter | ( | const AudioStream & | x | ) |
Definition at line 203 of file FilterLeastSquaresFIR.cc.
References Nsound::Filter::filter().
Referenced by Nsound::Buffer::_get_resample(), filter(), and FilterLeastSquaresFIR_UnitTest().
|
inline |
Definition at line 80 of file FilterLeastSquaresFIR.h.
References filter().
|
inline |
Definition at line 85 of file FilterLeastSquaresFIR.h.
References filter().
Definition at line 93 of file FilterLeastSquaresFIR.h.
References filter().
|
inline |
Definition at line 98 of file FilterLeastSquaresFIR.h.
References filter().
Implements Nsound::Filter.
Definition at line 217 of file FilterLeastSquaresFIR.cc.
References b_, Nsound::Filter::kernel_size_, x_end_ptr_, x_history_, and x_ptr_.
|
inlinevirtual |
Implements Nsound::Filter.
Definition at line 107 of file FilterLeastSquaresFIR.h.
References filter().
|
inline |
Definition at line 112 of file FilterLeastSquaresFIR.h.
References Nsound::Filter::getImpulseResponse().
FilterLeastSquaresFIR & FilterLeastSquaresFIR::operator= | ( | const FilterLeastSquaresFIR & | rhs | ) |
Definition at line 628 of file FilterLeastSquaresFIR.cc.
References a_axis_, b_, f_axis_, Nsound::Filter::kernel_size_, reset(), Nsound::Filter::sample_rate_, window_, x_end_ptr_, x_history_, and x_ptr_.
Definition at line 668 of file FilterLeastSquaresFIR.cc.
References Nsound::Filter::kernel_size_, Nsound::Filter::plot(), Nsound::Filter::sample_rate_, Nsound::Plotter::subplot(), and Nsound::Plotter::title().
|
virtual |
Resets interal history buffer and sets the cut off frequency to the one used at declaration.
Implements Nsound::Filter.
Definition at line 697 of file FilterLeastSquaresFIR.cc.
References Nsound::Filter::kernel_size_, x_history_, and x_ptr_.
Referenced by FilterLeastSquaresFIR(), makeKernel(), operator=(), and setKernel().
void FilterLeastSquaresFIR::setWindow | ( | WindowType | type | ) |
Definition at line 705 of file FilterLeastSquaresFIR.cc.
References a_axis_, Nsound::Generator::drawWindow(), f_axis_, Nsound::Buffer::getPointer(), Nsound::Filter::kernel_size_, makeKernel(), Nsound::Filter::sample_rate_, and window_.
Referenced by FilterLeastSquaresFIR_UnitTest().
Definition at line 260 of file FilterLeastSquaresFIR.cc.
References a_axis_, b_, Nsound::Generator::drawLine(), f_axis_, Nsound::Buffer::getDerivative(), Nsound::Buffer::getLength(), Nsound::Buffer::getMin(), Nsound::Buffer::getPointer(), Nsound::Buffer::getReverse(), Nsound::Filter::kernel_size_, M_PI, M_THROW, reset(), Nsound::Filter::sample_rate_, Nsound::Buffer::subbuffer(), and window_.
Referenced by FilterLeastSquaresFIR(), FilterLeastSquaresFIR_UnitTest(), and setWindow().
|
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(), 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(), plot(), Nsound::FilterFlanger::plot(), Nsound::FilterBandRejectFIR::plot(), Nsound::FilterBandRejectIIR::plot(), Nsound::FilterBandPassIIR::plot(), and Nsound::FilterParametricEqualizer::plot().
|
protected |
Definition at line 136 of file FilterLeastSquaresFIR.h.
Referenced by filter(), FilterLeastSquaresFIR(), getKernel(), makeKernel(), operator=(), setKernel(), and ~FilterLeastSquaresFIR().
|
protected |
Definition at line 137 of file FilterLeastSquaresFIR.h.
Referenced by FilterLeastSquaresFIR(), makeKernel(), operator=(), setKernel(), setWindow(), and ~FilterLeastSquaresFIR().
|
protected |
Definition at line 139 of file FilterLeastSquaresFIR.h.
Referenced by filter(), FilterLeastSquaresFIR(), operator=(), reset(), setKernel(), and ~FilterLeastSquaresFIR().
|
protected |
Definition at line 140 of file FilterLeastSquaresFIR.h.
Referenced by filter(), FilterLeastSquaresFIR(), operator=(), reset(), and setKernel().
|
protected |
Definition at line 141 of file FilterLeastSquaresFIR.h.
Referenced by filter(), FilterLeastSquaresFIR(), operator=(), and setKernel().
|
protected |
Definition at line 143 of file FilterLeastSquaresFIR.h.
Referenced by FilterLeastSquaresFIR(), getKernelFrequencies(), makeKernel(), operator=(), setWindow(), and ~FilterLeastSquaresFIR().
|
protected |
Definition at line 144 of file FilterLeastSquaresFIR.h.
Referenced by FilterLeastSquaresFIR(), getKernelAmplitudes(), makeKernel(), operator=(), setWindow(), and ~FilterLeastSquaresFIR().
|
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(), makeKernel(), Nsound::FilterParametricEqualizer::makeKernel(), Nsound::FilterPhaser::operator=(), 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(), plot(), Nsound::FilterFlanger::plot(), Nsound::FilterBandRejectFIR::plot(), Nsound::FilterBandPassIIR::plot(), Nsound::FilterBandRejectIIR::plot(), Nsound::FilterParametricEqualizer::plot(), Nsound::FilterLowPassIIR::setCutoff(), and 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(), filter(), Nsound::FilterBandPassFIR::FilterBandPassFIR(), Nsound::FilterBandPassIIR::FilterBandPassIIR(), Nsound::FilterBandRejectIIR::FilterBandRejectIIR(), Nsound::FilterHighPassIIR::FilterHighPassIIR(), FilterLeastSquaresFIR(), Nsound::FilterLowPassFIR::FilterLowPassFIR(), Nsound::FilterLowPassIIR::FilterLowPassIIR(), getKernel(), Nsound::Filter::getKernelSize(), Nsound::FilterHighPassFIR::makeKernel(), Nsound::FilterLowPassFIR::makeKernel(), Nsound::FilterBandRejectFIR::makeKernel(), makeKernel(), operator=(), Nsound::FilterLowPassFIR::plot(), Nsound::FilterHighPassFIR::plot(), plot(), Nsound::FilterBandRejectFIR::plot(), Nsound::FilterLowPassFIR::reset(), Nsound::FilterHighPassFIR::reset(), reset(), setKernel(), 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().