Synthesizer based on the Unzen / Nucleo F746ZG

Dependencies:   amakusa mbed-dsp mbed shimabara ukifune unzen_nucleo_f746

Fork of skeleton_unzen_nucleo_f746 by seiichi horie

雲仙フレームワークのテストとして作っているプロジェクトです。中身はどんどん変っていきます。 説明はDSP空挺団の「シンセサイザー」カテゴリーを参照してください。初回は「ドッグフードを食べる」です。

Committer:
shorie
Date:
Fri Feb 03 14:35:46 2017 +0000
Revision:
19:f5e785fe50b1
Child:
25:d15dd7b9101c
Total structure is refactored to use the Monophonic.

Who changed what in which revision?

UserRevisionLine numberNew 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 19:f5e785fe50b1 15 void DCBlocker::run( float32_t *pSrc, float32_t *pDst, uint32_t blockSize )
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 if ( blockSize == 0 )
shorie 19:f5e785fe50b1 19 blockSize = this->blockSize;
shorie 19:f5e785fe50b1 20
shorie 19:f5e785fe50b1 21 for ( int i = 0; i < blockSize; i++ )
shorie 19:f5e785fe50b1 22 {
shorie 19:f5e785fe50b1 23 // y = x - x * z^-1 + 0.995 * y * z^-1
shorie 19:f5e785fe50b1 24 pDst[ i ] = pSrc[ i ] - this->x_last + 0.995f * this->y_last;
shorie 19:f5e785fe50b1 25 this->x_last = pSrc[ i ];
shorie 19:f5e785fe50b1 26 this->y_last = pDst[ i ];
shorie 19:f5e785fe50b1 27 }
shorie 19:f5e785fe50b1 28
shorie 19:f5e785fe50b1 29 }