Synthesizer based on the Unzen / Nucleo F746ZG
Dependencies: amakusa mbed-dsp mbed shimabara ukifune unzen_nucleo_f746
Fork of skeleton_unzen_nucleo_f746 by
雲仙フレームワークのテストとして作っているプロジェクトです。中身はどんどん変っていきます。 説明はDSP空挺団の「シンセサイザー」カテゴリーを参照してください。初回は「ドッグフードを食べる」です。
dcblocker.cpp@25:d15dd7b9101c, 2017-02-10 (annotated)
- Committer:
- shorie
- Date:
- Fri Feb 10 13:28:41 2017 +0000
- Revision:
- 25:d15dd7b9101c
- Parent:
- 19:f5e785fe50b1
run() method of child classes of the amakusa::AbstractFilter are modified.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shorie | 19:f5e785fe50b1 | 1 | #include "signal_processing.h" |
shorie | 19:f5e785fe50b1 | 2 | |
shorie | 19:f5e785fe50b1 | 3 | /* |
shorie | 19:f5e785fe50b1 | 4 | * Related Link |
shorie | 19:f5e785fe50b1 | 5 | * https://www.dsprelated.com/freebooks/filters/DC_Blocker.html |
shorie | 19:f5e785fe50b1 | 6 | * https://ccrma.stanford.edu/~jos/fp/DC_Blocker.html |
shorie | 19:f5e785fe50b1 | 7 | */ |
shorie | 19:f5e785fe50b1 | 8 | |
shorie | 19:f5e785fe50b1 | 9 | DCBlocker::DCBlocker( uint32_t blockSize ) : amakusa::AbstractFilter ( blockSize ) |
shorie | 19:f5e785fe50b1 | 10 | { |
shorie | 19:f5e785fe50b1 | 11 | this->x_last = 0; |
shorie | 19:f5e785fe50b1 | 12 | this->y_last = 0; |
shorie | 19:f5e785fe50b1 | 13 | } |
shorie | 19:f5e785fe50b1 | 14 | |
shorie | 25:d15dd7b9101c | 15 | void DCBlocker::run( float32_t *pSrc, float32_t *pDst ) |
shorie | 19:f5e785fe50b1 | 16 | { |
shorie | 19:f5e785fe50b1 | 17 | // if the parameter is non-zero, take it. If the parameter is zero, use default. |
shorie | 19:f5e785fe50b1 | 18 | |
shorie | 25:d15dd7b9101c | 19 | for ( int i = 0; i < this->block_size; i++ ) |
shorie | 19:f5e785fe50b1 | 20 | { |
shorie | 19:f5e785fe50b1 | 21 | // y = x - x * z^-1 + 0.995 * y * z^-1 |
shorie | 19:f5e785fe50b1 | 22 | pDst[ i ] = pSrc[ i ] - this->x_last + 0.995f * this->y_last; |
shorie | 19:f5e785fe50b1 | 23 | this->x_last = pSrc[ i ]; |
shorie | 19:f5e785fe50b1 | 24 | this->y_last = pDst[ i ]; |
shorie | 19:f5e785fe50b1 | 25 | } |
shorie | 19:f5e785fe50b1 | 26 | |
shorie | 19:f5e785fe50b1 | 27 | } |