Synthesizer based on the Unzen / Nucleo F746ZG
Dependencies: amakusa mbed-dsp mbed shimabara ukifune unzen_nucleo_f746
Fork of skeleton_unzen_nucleo_f746 by
dcblocker.cpp
00001 #include "signal_processing.h" 00002 00003 /* 00004 * Related Link 00005 * https://www.dsprelated.com/freebooks/filters/DC_Blocker.html 00006 * https://ccrma.stanford.edu/~jos/fp/DC_Blocker.html 00007 */ 00008 00009 DCBlocker::DCBlocker( uint32_t blockSize ) : amakusa::AbstractFilter ( blockSize ) 00010 { 00011 this->x_last = 0; 00012 this->y_last = 0; 00013 } 00014 00015 void DCBlocker::run( float32_t *pSrc, float32_t *pDst ) 00016 { 00017 // if the parameter is non-zero, take it. If the parameter is zero, use default. 00018 00019 for ( int i = 0; i < this->block_size; i++ ) 00020 { 00021 // y = x - x * z^-1 + 0.995 * y * z^-1 00022 pDst[ i ] = pSrc[ i ] - this->x_last + 0.995f * this->y_last; 00023 this->x_last = pSrc[ i ]; 00024 this->y_last = pDst[ i ]; 00025 } 00026 00027 }
Generated on Wed Jul 13 2022 23:24:36 by 1.7.2