Basic Audio Signal Processing Library
Dependents: unzen_sample_nucleo_f746 skeleton_unzen_nucleo_f746 ifmag_noise_canceller synthesizer_f746
オーディオ信号処理用のライブラリです。
mbed-dspのフィルタ群向けに作ったクラス・ラッパーのほか、以下のクラスを用意しています。
- ヒステリシス
- sin/cosオシレータ
- リミッター
クラスは全て名前空間amakusaに含まれます。
oscsincos.h@0:058daa59980d, 2016-12-11 (annotated)
- Committer:
- shorie
- Date:
- Sun Dec 11 21:04:06 2016 +0000
- Revision:
- 0:058daa59980d
- Child:
- 2:fbdf03b330ae
Publish
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shorie | 0:058daa59980d | 1 | namespace amakusa |
shorie | 0:058daa59980d | 2 | { |
shorie | 0:058daa59980d | 3 | /** |
shorie | 0:058daa59980d | 4 | * \brief Sine & Cosine Oscillator |
shorie | 0:058daa59980d | 5 | */ |
shorie | 0:058daa59980d | 6 | class OSCSinCos |
shorie | 0:058daa59980d | 7 | { |
shorie | 0:058daa59980d | 8 | public: |
shorie | 0:058daa59980d | 9 | /** |
shorie | 0:058daa59980d | 10 | * \brief constructor |
shorie | 0:058daa59980d | 11 | * \param freq Frequency in Hz. |
shorie | 0:058daa59980d | 12 | * \param Fs Sampling frequency in Hz. |
shorie | 0:058daa59980d | 13 | */ |
shorie | 0:058daa59980d | 14 | OSCSinCos( float freq, int Fs ); |
shorie | 0:058daa59980d | 15 | /** |
shorie | 0:058daa59980d | 16 | * \brief wave generator method |
shorie | 0:058daa59980d | 17 | * \param c Pointer to the buffer to output the sine signal. |
shorie | 0:058daa59980d | 18 | * \param s Pointer to the buffer to output the cosine singal. If NULL, cosine signal will be skipped. |
shorie | 0:058daa59980d | 19 | * \params count Number of sample to be generated. |
shorie | 0:058daa59980d | 20 | */ |
shorie | 0:058daa59980d | 21 | void run( float *s, float *c , int count ); |
shorie | 0:058daa59980d | 22 | /** |
shorie | 0:058daa59980d | 23 | * \brief wave generator method |
shorie | 0:058daa59980d | 24 | * \param c Pointer to the buffer to output the sine signal. |
shorie | 0:058daa59980d | 25 | * \params count Number of sample to be generated. |
shorie | 0:058daa59980d | 26 | */ |
shorie | 0:058daa59980d | 27 | void run( float *s, int count ){run(s, 0, count);} |
shorie | 0:058daa59980d | 28 | /** |
shorie | 0:058daa59980d | 29 | * \brief set the oscillation furequncy. |
shorie | 0:058daa59980d | 30 | * \param freq Frequency in Hz. |
shorie | 0:058daa59980d | 31 | */ |
shorie | 0:058daa59980d | 32 | void setFrequency( float freq ); |
shorie | 0:058daa59980d | 33 | /** |
shorie | 0:058daa59980d | 34 | * \brief set the oscillator's internal phase |
shorie | 0:058daa59980d | 35 | * \param freq phase in radian. |
shorie | 0:058daa59980d | 36 | */ |
shorie | 0:058daa59980d | 37 | void setPhase( float phase ); |
shorie | 0:058daa59980d | 38 | /** |
shorie | 0:058daa59980d | 39 | * \brief get the oscillation furequncy. |
shorie | 0:058daa59980d | 40 | * \returns Frequency in Hz. |
shorie | 0:058daa59980d | 41 | */ |
shorie | 0:058daa59980d | 42 | float getFrequency(); |
shorie | 0:058daa59980d | 43 | /** |
shorie | 0:058daa59980d | 44 | * \brief get the internal phase |
shorie | 0:058daa59980d | 45 | * \returns Phase in radian |
shorie | 0:058daa59980d | 46 | */ |
shorie | 0:058daa59980d | 47 | float getPhase(); |
shorie | 0:058daa59980d | 48 | private: |
shorie | 0:058daa59980d | 49 | float deltaPhase; // deltaPhase per sample. |
shorie | 0:058daa59980d | 50 | int sampleFreq; // in Hz |
shorie | 0:058daa59980d | 51 | int phaseInSample; // internal phase [sample] |
shorie | 0:058daa59980d | 52 | }; |
shorie | 0:058daa59980d | 53 | |
shorie | 0:058daa59980d | 54 | } |
shorie | 0:058daa59980d | 55 |