class::calc::HighPassFilterF32

class calc::HighPassFilterF32
  : public calc::SimpleFilter< float, HighPassFilterF32 >

This class implements a simple high pass filter. The filter is defined by the following difference equation:

$$ y[n] = x[n] - x[n-1] + r * y[n-1] $$

The r value should be between zero and one. Values closer to one have a lower cutoff frequency.

#include <sapi/calc.hpp>

HighPassFilterF32 filter(0.0f, 0.9f);

filter << 0.1f; //input 0.1 into the filter
filter << 0.9f; //input another value

printf("Filter value is %0.1f\n", filter.present_value());

Members

HighPassFilterF32(

float start,
float r_value
)

float calculate(

float input
)

void reset(

float start
)

void set_initial_input(

float value
)

void set_r_value(

float r_value
)

Details

HighPassFilterF32(

float start,
float r_value
)

Constructs a High pass filter object for floating point calculations.


float calculate(

float input
)


void reset(

float start
)

Resets the filter to the given start value.


void set_initial_input(

float value
)


void set_r_value(

float r_value
)

Updates the r value of the filter.


X

Thanks for Coming!

Subscribe to news and updates