- C++ 99.7%
- Makefile 0.3%
| tests | ||
| .gitignore | ||
| amd.hh | ||
| atan2.hh | ||
| biquad.hh | ||
| blockdc.hh | ||
| calculus.hh | ||
| cdc.hh | ||
| coeffs.hh | ||
| complex.hh | ||
| const.hh | ||
| cordic.hh | ||
| decibel.hh | ||
| ema.hh | ||
| exp.hh | ||
| fdzp.hh | ||
| fft.hh | ||
| filter.hh | ||
| fmd.hh | ||
| hilbert.hh | ||
| kahan.hh | ||
| LICENSE | ||
| normalize.hh | ||
| pcm.hh | ||
| phasor.hh | ||
| README.md | ||
| regression.hh | ||
| resampler.hh | ||
| sma.hh | ||
| spline.hh | ||
| trigger.hh | ||
| unit_circle.hh | ||
| utils.hh | ||
| wav.hh | ||
| window.hh | ||
This is a work in progress and a long overdue attempt to bring all our DSP code together and make it reusable for our future projects.
Before using any of this you should enter the tests directory and execute "make". This will check if your compiler is able to create binaries that are able to produce correct results when executed.
What we have included so far:
kahan.hh
When working with Floating-point arithmetic we soon realize, that addition is not necessarily associative. For example, whenever we need to add values with an ever decreasing magnitude to a running sum with an ever increasing magnitude, the Kahan summation algorithm comes in handy and helps keeping the error growth small.
window.hh
Implemented are the follwing Window functions:
- Rectangular window
- Hann window
- Hamming window
- Lanczos window
- Blackman window
- Gaussian window
- Kaiser window
filter.hh
Implemented are the following finite impulse response filters:
ema.hh
The exponential moving average is an infinite impulse response low-pass filter. There is also support for cascading, to improve roll-off while a correction factor helps to keep the same cutoff frequency.
biquad.hh
The following infinite impulse response digital biquad filter implementations are available:
- second-order Butterworth low or high pass filter
- 2n-order Butterworth cascade of second-order low or high pass filters
- second-order notch filter
- second-order bandpass filter
- second-order allpass filter
blockdc.hh
A notch filter at DC helps removing DC bias.
normalize.hh
Normalizers for periodic signals.
phasor.hh
Numerically controlled oscillator implemented using a phasor and complex multiplication instead of a lookup table.
cdc.hh
hilbert.hh
fmd.hh
Frequency modulation demodulation with and without atan2.
amd.hh
Amplitude modulation demodulation with automatic gain control.
atan2.hh
exp.hh
Exponentiation approximations.
cordic.hh
When working on a device where multiplication is expensive, the CORDIC comes in handy for computing trigonometric functions.
The following implementations are a good (max 1 LSB error at full range) starting point for your own designs:
- Fixed-point atan2 implementation
trigger.hh
Implemented are the following trigger functions:
sma.hh
The simple moving average gives us the mean of the last N data points.
calculus.hh
Some calculus functions:
const.hh
Some constants we need
pcm.hh
Interface for reading and writing PCM data
wav.hh
Read and write WAV files
spline.hh
- Algorithm for computing uniform and natural cubic splines
- Cubic Hermite spline Very useful for data interpolation.
regression.hh
Implemented Simple linear regression for Regression analysis of data.
complex.hh
Faster alternative (no Inf/NaN handling) to the std::complex implementation.
fft.hh
Mixed-radix decimation-in-time fast Fourier transform
utils.hh
Some everyday helpers:
- signum function
- lerp function
- probability density function of the normal distribution
- sinc function
- delta function
decibel.hh
Decibel calculation helpers.
resampler.hh
When working with Analog-to-digital and Digital-to-analog converters, we often face the ugly truth, that we can't always have a precise Sampling rate. But if we can estimate the Sampling frequency offset, we can correct it by Resampling the sampled data.
fdzp.hh
Interpolation via frequency-domain zero padding.
unit_circle.hh
Sometimes we only need trigonometric functions that stay on the unit circle: