Code Monkey home page Code Monkey logo

fastfir's Introduction

FastFIR

1D real fast FIR filtering. It's really fast compared to slow filtering!!!

##API usage with Qt

Include qjfastfir.h and compile and link with qjfastfir.cpp

//create pointer
QJFastFIRFilter *fastfir;

//create FastFIR filter
fastfir = new QJFastFIRFilter(this);

//set the kernel of the filter, in this case a Low Pass filter at 800Hz
fastfir->setKernel(QJFilterDesign::LowPassHanning(800,48000,1001));

//process data (data is QVector<kffsamp_t>, eg "QVector<kffsamp_t> data;")
fastfir->Update(data);

##API usage with standard C++

Include jfastfir.h and compile and link with jfastfir.cpp

//create pointer
JFastFIRFilter *fastfir;

//create FastFIR filter
fastfir = new JFastFIRFilter;

//set the kernel of the filter, in this case a Low Pass filter at 800Hz
fastfir->setKernel(JFilterDesign::LowPassHanning(800,48000,1001));

//process data (data is vector<kffsamp_t>, eg "vector<kffsamp_t> data;")
fastfir->Update(data);

//delete FastFIR filter
delete fastfir;

##Getting started

Clone/Download repository.

Demo project requires at least Qt5. Open FastFIR/Demo/Demo.pro with Qt creator and run. Demo compares slow FIR and fast FIR times and low pass filter's noise at 800Hz and outputs this to the default soundcard device.

Demo program output

##Filters designs included

The class QJFilterDesign/JFilterDesign contains the following filter designs as static member functions

  • LPF Low Pass Filter
  • HPF High Pass Filter
  • BPF Band Pass Filter
  • BSF Band Stop Filter

The static members for the Qt version are as follows where frequencies are in Hz and Samplerate is in samples per second.

QVector<kffsamp_t> LowPassHanning(double FrequencyCutOff, double SampleRate, int Length);
QVector<kffsamp_t> HighPassHanning(double FrequencyCutOff, double SampleRate, int Length);
QVector<kffsamp_t> BandPassHanning(double LowFrequencyCutOff,double HighFrequencyCutOff, double SampleRate, int Length);
QVector<kffsamp_t> BandStopHanning(double LowFrequencyCutOff,double HighFrequencyCutOff, double SampleRate, int Length);

These designs return the kernel for use with the FastFir. For example, to create a BPF that has a FIR length of 1001 that covers 1000Hz to 2000Hz and a Samplerate of 48000bps then following code can be used.

...
//set the kernel of the filter, in this case a BPF from 1kHz to 2kHz
fastfir->setKernel(QJFilterDesign::BandPassHanning(1000,2000,48000,1001));
...

##QJFastFIRFilter member Update

The QJFastFIRFilter class contains the public member function "Update" that does the processing of the raw input signal/data. Its prototype is as follows.

void Update(QVector<kffsamp_t> &data);

It is designed so that it reads "data", filteres it, then replaces "data" with the filtered responce. It performs internal buffering so that no matter how much data is given to "Update", "Update" will replace every item in "data". Basicly this makes it eaiser to design applications.

Jonti 2015 http://jontio.zapto.org

fastfir's People

Watchers

 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.