Experimental implementation of the adaptive filter of "Interface" magazine in 2016-2017
Dependencies: amakusa mbed-dsp mbed shimabara ukifune unzen_nucleo_f746
Fork of skeleton_unzen_nucleo_f746 by
ハードウェアおよびソフトウェアはskelton_unzen_nucleo_f746を基本にしています。
Diff: dcblocker.cpp
- Revision:
- 20:699e209fd19a
- Parent:
- 19:f5e785fe50b1
--- a/dcblocker.cpp Fri Feb 03 14:35:46 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -#include "signal_processing.h" - -/* -* Related Link -* https://www.dsprelated.com/freebooks/filters/DC_Blocker.html -* https://ccrma.stanford.edu/~jos/fp/DC_Blocker.html -*/ - -DCBlocker::DCBlocker( uint32_t blockSize ) : amakusa::AbstractFilter ( blockSize ) -{ - this->x_last = 0; - this->y_last = 0; -} - -void DCBlocker::run( float32_t *pSrc, float32_t *pDst, uint32_t blockSize ) -{ - // if the parameter is non-zero, take it. If the parameter is zero, use default. - if ( blockSize == 0 ) - blockSize = this->blockSize; - - for ( int i = 0; i < blockSize; i++ ) - { - // y = x - x * z^-1 + 0.995 * y * z^-1 - pDst[ i ] = pSrc[ i ] - this->x_last + 0.995f * this->y_last; - this->x_last = pSrc[ i ]; - this->y_last = pDst[ i ]; - } - -}