Nsound
0.9.4
|
Base class for IIR Filters, defines the interface. More...
#include <Nsound/Filter.h>
Public Member Functions | |
Filter (const float64 &sample_rate) | |
virtual | ~Filter () |
void | setRealtime (bool flag) |
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)=0 |
virtual float64 | filter (const float64 &x, const float64 &frequency)=0 |
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) |
virtual void | reset ()=0 |
Protected Attributes | |
float64 | sample_rate_ |
float64 | two_pi_over_sample_rate_ |
float64 | sample_time_ |
uint32 | kernel_size_ |
bool | is_realtime_ |
|
inline |
AudioStream Filter::filter | ( | const AudioStream & | x | ) |
Definition at line 53 of file Filter.cc.
References Nsound::AudioStream::getNChannels(), Nsound::AudioStream::getSampleRate(), is_realtime_, M_THROW, and reset().
Referenced by Nsound::FilterHighPassIIR::filter(), Nsound::FilterHighPassFIR::filter(), Nsound::FilterLowPassFIR::filter(), Nsound::FilterLowPassIIR::filter(), Nsound::FilterTone::filter(), Nsound::FilterDelay::filter(), Nsound::FilterAllPass::filter(), Nsound::FilterMovingAverage::filter(), Nsound::FilterFlanger::filter(), filter(), Nsound::FilterCombLowPassFeedback::filter(), Nsound::FilterBandPassVocoder::filter(), Nsound::FilterPhaser::filter(), Nsound::FilterBandPassFIR::filter(), Nsound::FilterBandRejectFIR::filter(), Nsound::FilterBandRejectIIR::filter(), Nsound::FilterBandPassIIR::filter(), Nsound::FilterStageIIR::filter(), Nsound::FilterLeastSquaresFIR::filter(), Nsound::FilterIIR::filter(), and getImpulseResponse().
AudioStream Filter::filter | ( | const AudioStream & | x, |
const float64 & | frequency | ||
) |
Definition at line 76 of file Filter.cc.
References filter(), Nsound::AudioStream::getNChannels(), Nsound::AudioStream::getSampleRate(), is_realtime_, M_THROW, and reset().
AudioStream Filter::filter | ( | const AudioStream & | x, |
const Buffer & | frequencies | ||
) |
Definition at line 99 of file Filter.cc.
References filter(), Nsound::AudioStream::getNChannels(), Nsound::AudioStream::getSampleRate(), is_realtime_, M_THROW, and reset().
Definition at line 122 of file Filter.cc.
References filter(), Nsound::Buffer::getLength(), is_realtime_, and reset().
Definition at line 140 of file Filter.cc.
References Nsound::Buffer::begin(), Nsound::Buffer::end(), filter(), Nsound::Buffer::getLength(), is_realtime_, and reset().
Definition at line 161 of file Filter.cc.
References Nsound::Buffer::begin(), Nsound::Buffer::cbegin(), Nsound::Buffer::end(), filter(), Nsound::Buffer::getLength(), is_realtime_, and reset().
Implemented in Nsound::FilterParametricEqualizer, Nsound::FilterBandPassIIR, Nsound::FilterBandRejectIIR, Nsound::FilterIIR, Nsound::FilterBandPassFIR, Nsound::FilterBandRejectFIR, Nsound::FilterFlanger, Nsound::FilterLeastSquaresFIR, Nsound::FilterBandPassVocoder, Nsound::FilterStageIIR, Nsound::FilterAllPass, Nsound::FilterMovingAverage, Nsound::FilterDelay, Nsound::FilterSlinky, Nsound::FilterCombLowPassFeedback, Nsound::FilterLowPassIIR, Nsound::FilterLowPassFIR, Nsound::FilterHighPassFIR, Nsound::FilterHighPassIIR, Nsound::FilterPhaser, Nsound::FilterTone, and Nsound::FilterLowPassMoogVcf.
|
pure virtual |
Implemented in Nsound::FilterParametricEqualizer, Nsound::FilterBandPassIIR, Nsound::FilterBandRejectIIR, Nsound::FilterIIR, Nsound::FilterBandPassFIR, Nsound::FilterBandRejectFIR, Nsound::FilterLeastSquaresFIR, Nsound::FilterFlanger, Nsound::FilterBandPassVocoder, Nsound::FilterStageIIR, Nsound::FilterMovingAverage, Nsound::FilterAllPass, Nsound::FilterDelay, Nsound::FilterSlinky, Nsound::FilterCombLowPassFeedback, Nsound::FilterLowPassIIR, Nsound::FilterLowPassFIR, Nsound::FilterHighPassFIR, Nsound::FilterHighPassIIR, Nsound::FilterPhaser, Nsound::FilterTone, and Nsound::FilterLowPassMoogVcf.
Definition at line 185 of file Filter.cc.
References Nsound::FFTransform::roundUp2(), and sample_rate_.
Referenced by main(), plot(), and Nsound::FilterIIR::savePlot().
Definition at line 210 of file Filter.cc.
References Nsound::FFTransform::fft(), getImpulseResponse(), and sample_rate_.
Referenced by Nsound::FilterBandPassIIR::FilterBandPassIIR(), FilterLeastSquaresFIR_UnitTest(), Nsound::FilterIIR::getRMS(), main(), plot(), and Nsound::FilterIIR::savePlot().
Definition at line 225 of file Filter.cc.
References filter(), is_realtime_, and reset().
Referenced by getFrequencyResponse(), Nsound::FilterHighPassFIR::getImpulseResponse(), Nsound::FilterLowPassFIR::getImpulseResponse(), Nsound::FilterLeastSquaresFIR::getImpulseResponse(), Nsound::FilterIIR::getImpulseResponse(), and getPhaseResponse().
|
inlinevirtual |
Reimplemented in Nsound::FilterIIR, and Nsound::FilterTone.
Definition at line 96 of file Filter.h.
References kernel_size_.
Referenced by Nsound::FilterBandPassIIR::FilterBandPassIIR(), Nsound::FilterBandPassFIR::plot(), Nsound::FilterBandPassIIR::plot(), and Nsound::FilterBandRejectIIR::plot().
Buffer Filter::getPhaseResponse | ( | ) |
Definition at line 245 of file Filter.cc.
References Nsound::FFTransform::fft(), getImpulseResponse(), Nsound::Buffer::getLength(), sample_rate_, and Nsound::Buffer::subbuffer().
Referenced by plot().
|
inline |
void Filter::plot | ( | boolean | show_phase = false | ) |
Definition at line 262 of file Filter.cc.
References Nsound::Plotter::figure(), Nsound::Buffer::getdB(), getFrequencyAxis(), getFrequencyResponse(), Nsound::Buffer::getMax(), 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::FilterBandPassIIR::plot(), Nsound::FilterBandRejectIIR::plot(), and Nsound::FilterParametricEqualizer::plot().
|
pure virtual |
Implemented in Nsound::FilterParametricEqualizer, Nsound::FilterBandPassIIR, Nsound::FilterBandRejectIIR, Nsound::FilterIIR, Nsound::FilterBandRejectFIR, Nsound::FilterLeastSquaresFIR, Nsound::FilterBandPassFIR, Nsound::FilterFlanger, Nsound::FilterBandPassVocoder, Nsound::FilterStageIIR, Nsound::FilterHighPassFIR, Nsound::FilterLowPassFIR, Nsound::FilterAllPass, Nsound::FilterMovingAverage, Nsound::FilterCombLowPassFeedback, Nsound::FilterLowPassIIR, Nsound::FilterDelay, Nsound::FilterTone, Nsound::FilterHighPassIIR, Nsound::FilterPhaser, Nsound::FilterSlinky, and Nsound::FilterLowPassMoogVcf.
Referenced by filter(), and getImpulseResponse().
|
protected |
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(), getFrequencyAxis(), getFrequencyResponse(), getPhaseResponse(), 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(), Nsound::FilterLowPassFIR::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().
|
protected |
Definition at line 114 of file Filter.h.
Referenced by Nsound::FilterTone::makeKernel(), Nsound::FilterLowPassFIR::makeKernel(), and Nsound::FilterParametricEqualizer::makeKernel().
|
protected |
Definition at line 115 of file Filter.h.
Referenced by Nsound::FilterLowPassMoogVcf::_make_filter().
|
protected |
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(), 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_().
|
protected |
Definition at line 118 of file Filter.h.
Referenced by filter(), Nsound::FilterBandRejectIIR::filter(), Nsound::FilterBandRejectFIR::filter(), getImpulseResponse(), and setRealtime().