mirror of
https://github.com/aicodix/dsp.git
synced 2026-04-27 14:30:36 +00:00
added low pass which only uses unit circle
This commit is contained in:
parent
f141e04dc6
commit
475114d2e1
1 changed files with 17 additions and 0 deletions
17
filter.hh
17
filter.hh
|
|
@ -8,6 +8,7 @@ Copyright 2018 Ahmet Inan <inan@aicodix.de>
|
|||
|
||||
#include "const.hh"
|
||||
#include "utils.hh"
|
||||
#include "unit_circle.hh"
|
||||
|
||||
namespace DSP {
|
||||
|
||||
|
|
@ -24,6 +25,22 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <typename TYPE>
|
||||
class LowPass2
|
||||
{
|
||||
int num, den;
|
||||
TYPE fac;
|
||||
public:
|
||||
LowPass2(int num, int den) : num(num), den(den), fac(TYPE(2*num)/TYPE(den)) {}
|
||||
TYPE operator () (int n, int N)
|
||||
{
|
||||
int twox = 2 * n - (N - 1);
|
||||
return !twox ? fac : fac *
|
||||
UnitCircle<TYPE>::sin((twox * num) % (2 * den), 2 * den) /
|
||||
(Const<TYPE>::HalfPi() * fac * TYPE(twox));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename TYPE>
|
||||
class HighPass
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue