AME
ame::dsp::RcLowPass< FloatType > Class Template Reference

RC low-pass filter for parameter smoothing. More...

#include <ame_RcLowPass.hpp>

Public Member Functions

 RcLowPass (FloatType sampleRate)
 
void setSampleRate (FloatType newSampleRate) noexcept
 Set new sampleRate.
 
void setCutOffFrequency (FloatType cutOffFrequency) noexcept
 LPF cutoff. More...
 
void setRawCoefficient (FloatType newRawCoefficient)
 Set raw coefficient value. More...
 
FloatType getRawCoefficient () const noexcept
 Get raw value of coefficient. More...
 
FloatType process (FloatType input) noexcept
 Process filter. More...
 

Detailed Description

template<std::floating_point FloatType>
class ame::dsp::RcLowPass< FloatType >

RC low-pass filter for parameter smoothing.

y[t] = x[t] * coef + (1-coef) * y[t-1]

Template Parameters
FloatTypefloat or double

Member Function Documentation

◆ getRawCoefficient()

template<std::floating_point FloatType>
FloatType ame::dsp::RcLowPass< FloatType >::getRawCoefficient ( ) const
inlinenoexcept

Get raw value of coefficient.

Returns
FloatType

◆ process()

template<std::floating_point FloatType>
FloatType ame::dsp::RcLowPass< FloatType >::process ( FloatType  input)
inlinenoexcept

Process filter.

Parameters
input
Returns
FloatType Filtered output

◆ setCutOffFrequency()

template<std::floating_point FloatType>
void ame::dsp::RcLowPass< FloatType >::setCutOffFrequency ( FloatType  cutOffFrequency)
inlinenoexcept

LPF cutoff.

a=\frac{2\pi\cdotΔT\cdot f_{c}}{2\pi\cdotΔT\cdot f_{c}+1}

Parameters
cutOffFrequencycutoff frequency in Hz

◆ setRawCoefficient()

template<std::floating_point FloatType>
void ame::dsp::RcLowPass< FloatType >::setRawCoefficient ( FloatType  newRawCoefficient)
inline

Set raw coefficient value.

Parameters
newRawCoefficient[0.0 < newRawCoefficient <= 1.0]
Attention
0より大きな、1以下の値でないといけない。0だとy[t-1]のみがバイアスとして出力されてしまうし、1以上だと発散してしまう。

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