
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/FFT_Analyzer.cpp@1:cc596a8d40c9, 2017-02-21 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Tue Feb 21 13:25:58 2017 +0000
- Revision:
- 1:cc596a8d40c9
- Parent:
- 0:a539141b9dec
- Child:
- 6:c38ec7939609
2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 0:a539141b9dec | 1 | //------------------------------------------------------- |
MikamiUitOpen | 0:a539141b9dec | 2 | // Class for spectrum analysis using FFT |
MikamiUitOpen | 0:a539141b9dec | 3 | // |
MikamiUitOpen | 0:a539141b9dec | 4 | // 2017/02/04, Copyright (c) 2017 MIKAMI, Naoki |
MikamiUitOpen | 0:a539141b9dec | 5 | //------------------------------------------------------- |
MikamiUitOpen | 0:a539141b9dec | 6 | |
MikamiUitOpen | 0:a539141b9dec | 7 | #include "FFT_Analyzer.hpp" |
MikamiUitOpen | 0:a539141b9dec | 8 | |
MikamiUitOpen | 0:a539141b9dec | 9 | namespace Mikami |
MikamiUitOpen | 0:a539141b9dec | 10 | { |
MikamiUitOpen | 0:a539141b9dec | 11 | FftAnalyzer::FftAnalyzer(int nData, int nFft) |
MikamiUitOpen | 0:a539141b9dec | 12 | : AnalyzerBase(nData, nFft, nFft), |
MikamiUitOpen | 0:a539141b9dec | 13 | yFft_(nFft/2+1) {} |
MikamiUitOpen | 0:a539141b9dec | 14 | |
MikamiUitOpen | 0:a539141b9dec | 15 | void FftAnalyzer::Analyze(const float xn[], float yn[]) |
MikamiUitOpen | 0:a539141b9dec | 16 | { |
MikamiUitOpen | 0:a539141b9dec | 17 | fft_.Execute(xn, yFft_); // Execute FFT |
MikamiUitOpen | 0:a539141b9dec | 18 | |
MikamiUitOpen | 0:a539141b9dec | 19 | // Translate to dB |
MikamiUitOpen | 0:a539141b9dec | 20 | for (int n=0; n<=N_FFT_/2; n++) |
MikamiUitOpen | 0:a539141b9dec | 21 | yn[n] = 10.0f*log10f(Norm(yFft_[n])); |
MikamiUitOpen | 0:a539141b9dec | 22 | } |
MikamiUitOpen | 0:a539141b9dec | 23 | } |