Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
Loading...
Searching...
No Matches
OnePole.h
1/*
2 * Adapted from: http://www.earlevel.com/main/2012/12/15/a-one-pole-filter/
3 *
4 * by: Adán L. Benito
5 * on: November 2018
6 * original code by Nigel Redmon
7 *
8 */
9#pragma once
10
11class OnePole
12{
13public:
14 typedef enum {
15 LOWPASS,
16 HIGHPASS,
17 } Type;
18 OnePole();
19 OnePole(float cutoff, float samplingRate, Type type = LOWPASS);
20 int setup(float cutoff, float samplingRate, Type type = LOWPASS);
21 void setFilter(float cutoff, Type type = LOWPASS);
22 float process(float input);
23private:
24 float _samplingRate;
25 int _type;
26 float a0, b1, ym1;
27 void setFc(float cutoff);
28};