Realtime sound spectrogram using FFT or linear prediction. Spectrogram is displayed on the display of PC. リアルタイム・スペクトログラム.解析の手法:FFT,線形予測法.スペクトログラムは PC のディスプレー装置に表示される.PC 側のプログラム:F446_Spectrogram.
Dependencies: Array_Matrix mbed SerialTxRxIntr F446_AD_DA UIT_FFT_Real
MySpectrogram/AnalyzerBase.cpp@0:a539141b9dec, 2017-02-17 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Fri Feb 17 04:55:10 2017 +0000
- Revision:
- 0:a539141b9dec
- Child:
- 6:c38ec7939609
1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 0:a539141b9dec | 1 | //------------------------------------------------------- |
MikamiUitOpen | 0:a539141b9dec | 2 | // Base abstract class for spectrum analysis |
MikamiUitOpen | 0:a539141b9dec | 3 | // |
MikamiUitOpen | 0:a539141b9dec | 4 | // 2017/02/09, Copyright (c) 2017 MIKAMI, Naoki |
MikamiUitOpen | 0:a539141b9dec | 5 | //------------------------------------------------------- |
MikamiUitOpen | 0:a539141b9dec | 6 | |
MikamiUitOpen | 0:a539141b9dec | 7 | #include "AnalyzerBase.hpp" |
MikamiUitOpen | 0:a539141b9dec | 8 | |
MikamiUitOpen | 0:a539141b9dec | 9 | namespace Mikami |
MikamiUitOpen | 0:a539141b9dec | 10 | { |
MikamiUitOpen | 0:a539141b9dec | 11 | AnalyzerBase::AnalyzerBase(int nData, int nFft, int nUse) |
MikamiUitOpen | 0:a539141b9dec | 12 | : N_DATA_(nData), N_FFT_(nFft), |
MikamiUitOpen | 0:a539141b9dec | 13 | fft_(nFft), wHm_(nData-1, nUse), b1_(1.0f), |
MikamiUitOpen | 0:a539141b9dec | 14 | xData_(nUse), wData_(nUse) {} |
MikamiUitOpen | 0:a539141b9dec | 15 | |
MikamiUitOpen | 0:a539141b9dec | 16 | void AnalyzerBase::Execute(const float xn[], float db[]) |
MikamiUitOpen | 0:a539141b9dec | 17 | { |
MikamiUitOpen | 0:a539141b9dec | 18 | // 高域強調 |
MikamiUitOpen | 0:a539141b9dec | 19 | for (int n=0; n<N_DATA_-1; n++) |
MikamiUitOpen | 0:a539141b9dec | 20 | xData_[n] = xn[n+1] - b1_*xn[n]; |
MikamiUitOpen | 0:a539141b9dec | 21 | |
MikamiUitOpen | 0:a539141b9dec | 22 | // 窓掛け |
MikamiUitOpen | 0:a539141b9dec | 23 | wHm_.Execute(xData_, wData_); |
MikamiUitOpen | 0:a539141b9dec | 24 | |
MikamiUitOpen | 0:a539141b9dec | 25 | Analyze(wData_, db); |
MikamiUitOpen | 0:a539141b9dec | 26 | } |
MikamiUitOpen | 0:a539141b9dec | 27 | } |