Basic Audio Signal Processing Library
Dependents: unzen_sample_nucleo_f746 skeleton_unzen_nucleo_f746 ifmag_noise_canceller synthesizer_f746
オーディオ信号処理用のライブラリです。
mbed-dspのフィルタ群向けに作ったクラス・ラッパーのほか、以下のクラスを用意しています。
- ヒステリシス
- sin/cosオシレータ
- リミッター
クラスは全て名前空間amakusaに含まれます。
Diff: oscsincos.cpp
- Revision:
- 2:fbdf03b330ae
- Parent:
- 0:058daa59980d
--- a/oscsincos.cpp Mon Jan 02 11:04:49 2017 +0000 +++ b/oscsincos.cpp Sat Jan 21 07:16:37 2017 +0000 @@ -7,27 +7,32 @@ #define M_PI 3.141592653589793F #endif -amakusa::OSCSinCos::OSCSinCos( float freq, int Fs ) +amakusa::OSCSinCos::OSCSinCos( float freq, int Fs, int block_size ) { this->sampleFreq = Fs; this->setFrequency( freq ); this->setPhase( 0.0 ); // must call after setFrequenc() + this->bs = block_size; } -void amakusa::OSCSinCos::run( float *s, float *c , int count ) +void amakusa::OSCSinCos::run( float *s, float *c) { - for ( int i=0; i<count; i++ ) + + for ( int i=0; i<this->bs; i++ ) { // to make the expression simple float phase = this->deltaPhase * ( i+ this->phaseInSample ); + // normal sind cosine s[i] = std::sin( phase ); // skip cosine if c is NULL if ( c != NULL ) c[i] = std::cos( phase ); + + } // update the internal phase - this->phaseInSample += count; + this->phaseInSample += this->bs; // truncate the phase while ( this->phaseInSample >= this->sampleFreq ) this->phaseInSample -= this->sampleFreq;