Nsound
0.9.4
|
#include <Nsound/FilterLowPassFIR.h>
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< Kernel > | KernelCache |
Protected Member Functions | |
void | makeKernel (const float64 &frequency1) |
Protected Attributes | |
float64 * | b_ |
float64 * | window_ |
float64 * | x_history_ |
float64 * | x_ptr_ |
float64 * | x_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 ©) | |
FilterLowPassFIR & | operator= (const FilterLowPassFIR &rhs) |
Definition at line 44 of file FilterLowPassFIR.h.
|
protected |
Definition at line 126 of file FilterLowPassFIR.h.
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_.
|
virtual |
|
private |
Definition at line 93 of file FilterLowPassFIR.cc.
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().
AudioStream FilterLowPassFIR::filter | ( | const AudioStream & | x, |
const float64 & | frequency | ||
) |
AudioStream FilterLowPassFIR::filter | ( | const AudioStream & | x, |
const Buffer & | frequencies | ||
) |
Definition at line 152 of file FilterLowPassFIR.cc.
References Nsound::Buffer::begin(), Nsound::Buffer::end(), filter(), Nsound::Buffer::getLength(), makeKernel(), and reset().
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_.
Implements Nsound::Filter.
Definition at line 225 of file FilterLowPassFIR.cc.
References filter(), and makeKernel().
|
inline |
Definition at line 81 of file FilterLowPassFIR.h.
References frequency_1_Hz_.
Referenced by Nsound::FilterBandPassFIR::getFrequencyHigh(), and Nsound::FilterBandPassFIR::plot().
Buffer FilterLowPassFIR::getImpulseResponse | ( | ) |
Definition at line 233 of file FilterLowPassFIR.cc.
References Nsound::Filter::getImpulseResponse().
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().
|
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().
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().
|
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().
|
inlineprivate |
Definition at line 135 of file FilterLowPassFIR.h.
|
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(), 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(), 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().
|
protected |
Definition at line 104 of file FilterLowPassFIR.h.
Referenced by filter(), Nsound::FilterHighPassFIR::makeKernel(), makeKernel(), Nsound::FilterBandRejectFIR::makeKernel(), and Nsound::FilterHighPassFIR::spectraReversal_().
|
protected |
Definition at line 105 of file FilterLowPassFIR.h.
Referenced by FilterLowPassFIR(), makeKernel(), and ~FilterLowPassFIR().
|
protected |
Definition at line 108 of file FilterLowPassFIR.h.
Referenced by filter(), FilterLowPassFIR(), reset(), Nsound::FilterHighPassFIR::reset(), and ~FilterLowPassFIR().
|
protected |
Definition at line 109 of file FilterLowPassFIR.h.
Referenced by filter(), FilterLowPassFIR(), reset(), and Nsound::FilterHighPassFIR::reset().
|
protected |
Definition at line 110 of file FilterLowPassFIR.h.
Referenced by filter(), and FilterLowPassFIR().
|
protected |
Definition at line 112 of file FilterLowPassFIR.h.
Referenced by Nsound::FilterBandRejectFIR::FilterBandRejectFIR(), Nsound::FilterHighPassFIR::FilterHighPassFIR(), Nsound::FilterHighPassFIR::getFrequency(), getFrequency(), Nsound::FilterBandRejectFIR::getFrequencyLow(), plot(), Nsound::FilterHighPassFIR::plot(), Nsound::FilterBandRejectFIR::plot(), reset(), Nsound::FilterHighPassFIR::reset(), Nsound::FilterBandRejectFIR::reset(), and setCutoff().
|
protected |
Definition at line 128 of file FilterLowPassFIR.h.
Referenced by makeKernel(), and ~FilterLowPassFIR().
|
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().
|
protectedinherited |
Definition at line 114 of file Filter.h.
Referenced by Nsound::FilterTone::makeKernel(), 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 filter(), Nsound::FilterLeastSquaresFIR::filter(), Nsound::FilterBandPassFIR::FilterBandPassFIR(), Nsound::FilterBandPassIIR::FilterBandPassIIR(), Nsound::FilterBandRejectIIR::FilterBandRejectIIR(), Nsound::FilterHighPassIIR::FilterHighPassIIR(), Nsound::FilterLeastSquaresFIR::FilterLeastSquaresFIR(), FilterLowPassFIR(), Nsound::FilterLowPassIIR::FilterLowPassIIR(), Nsound::FilterLeastSquaresFIR::getKernel(), Nsound::Filter::getKernelSize(), Nsound::FilterHighPassFIR::makeKernel(), makeKernel(), Nsound::FilterBandRejectFIR::makeKernel(), Nsound::FilterLeastSquaresFIR::makeKernel(), Nsound::FilterLeastSquaresFIR::operator=(), plot(), Nsound::FilterHighPassFIR::plot(), Nsound::FilterLeastSquaresFIR::plot(), Nsound::FilterBandRejectFIR::plot(), 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().