Giter Club home page Giter Club logo

ofxbiquadfilter's Introduction

ofxBiquadFilter

This openFrameworks addon implements a biquad filter. Use it when you need to filter a value over time. You can set it to filter out high frequancy noise (lowpass filter), this could for example be fast mouse movements, or other noisy data. Or you can use it as a highpassfilter that only will let fast movements through, this could for example be used to detect abrupt changes in a value.

Usage

For normal use, the only value that you need to change is the fc value. This describes the cutoff frequency, where 1 is the rate you supply new values. So for example, if you supply values 60 times a second (60 fps), then a fc value of 0.5 means the filter will cut off 30hz.

The addon comes with filters that supports both 1d, 2d 3d and 4d vectors, and it can also work of ofFloatColors. The types are

  • ofxBiquadFilter1f
  • ofxBiquadFilter2f
  • ofxBiquadFilter3f
  • ofxBiquadFilter4f
  • ofxBiquadFilterColor

The type of the filter can be set with the command .setType(ofxBiquadFilterType type). The most commonly used filter types are the OFX_BIQUAD_TYPE_LOWPASS (default) and OFX_BIQUAD_TYPE_HIGHPASS, but there are other types of filters defined.

Call update(..) with the new input value to update the filter, and get the filtered value by calling value().

Example

in the header:

ofxBiquadFilter2f filter;

in the cpp:

void setup(){
  // Sets the cutoff frequency to 1/10 of the framerate
  // Lowering this value will make the circle move slower
  filter.setFc(0.1);  
}

void update(){
  //Update the filter
  filter.update(ofVec2f(mouseX,mouseY));
}

void draw(){
  ofCircle(filter.value().x, filter.value().y);
}

Interactive tool

You can use this tool to visualize the biquad filters and it's values: http://www.earlevel.com/main/2013/10/13/biquad-calculator-v2/

Created by Jonas Jongejan and DZL

ofxbiquadfilter's People

Contributors

halfdanj avatar smukkejohan avatar dzlonline avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.