Realtime spectrum analyzer. Using FFT, linear prediction, or cepstrum smoothing. Version using MEMS microphone and CODEC, named "F746_RealtimeSpectrumAnalyzer_MEMS_Mic" is registered. リアルタイム スペクトル解析器.解析の手法:FFT,線形予測法,ケプストラムによる平滑化の3種類.このプログラムの説明は,CQ出版社のインターフェース誌,2016年4月号に掲載.外付けのマイクまたは他の信号源等を A0 に接続する.線形予測法,ケプストラムは,スペクトル解析の対象を音声信号に想定してパラメータを設定している.MEMS マイクと CODEC を使ったバージョンを "F746_RealtimeSpectrumAnalyzer_MEMS_Mic" として登録.

Dependencies:   BSP_DISCO_F746NG BUTTON_GROUP LCD_DISCO_F746NG TS_DISCO_F746NG UIT_FFT_Real mbed

Committer:
MikamiUitOpen
Date:
Mon Dec 14 13:44:42 2015 +0000
Revision:
3:7c26b701f363
Parent:
0:5c237fdcba23
Child:
4:99d4d5ea06a2
4

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MikamiUitOpen 0:5c237fdcba23 1 //-------------------------------------------------------
MikamiUitOpen 0:5c237fdcba23 2 // Base class for spectrum analysis (Header)
MikamiUitOpen 0:5c237fdcba23 3 //
MikamiUitOpen 3:7c26b701f363 4 // 2015/12/14, Copyright (c) 2015 MIKAMI, Naoki
MikamiUitOpen 0:5c237fdcba23 5 //-------------------------------------------------------
MikamiUitOpen 0:5c237fdcba23 6
MikamiUitOpen 0:5c237fdcba23 7 #ifndef BASE_ANALYZER_HPP
MikamiUitOpen 0:5c237fdcba23 8 #define BASE_ANALYZER_HPP
MikamiUitOpen 0:5c237fdcba23 9
MikamiUitOpen 0:5c237fdcba23 10 #include "fftReal.hpp"
MikamiUitOpen 0:5c237fdcba23 11 #include "Hamming.hpp"
MikamiUitOpen 0:5c237fdcba23 12
MikamiUitOpen 0:5c237fdcba23 13 namespace Mikami
MikamiUitOpen 0:5c237fdcba23 14 {
MikamiUitOpen 0:5c237fdcba23 15 class AnalyzerBase
MikamiUitOpen 0:5c237fdcba23 16 {
MikamiUitOpen 0:5c237fdcba23 17 public:
MikamiUitOpen 3:7c26b701f363 18 // nData: Number of data to be analyzed
MikamiUitOpen 3:7c26b701f363 19 // nFft: Number of FFT points
MikamiUitOpen 3:7c26b701f363 20 // nUse: FFT, cepstrum: window width + zero padding
MikamiUitOpen 3:7c26b701f363 21 // Linear prediction: window width
MikamiUitOpen 3:7c26b701f363 22 AnalyzerBase(int nData, int nFft, int nUse);
MikamiUitOpen 0:5c237fdcba23 23 virtual ~AnalyzerBase();
MikamiUitOpen 0:5c237fdcba23 24 void Execute(const float xn[], float db[]);
MikamiUitOpen 0:5c237fdcba23 25
MikamiUitOpen 0:5c237fdcba23 26 protected:
MikamiUitOpen 0:5c237fdcba23 27 const int N_DATA_;
MikamiUitOpen 0:5c237fdcba23 28 const int N_FFT_;
MikamiUitOpen 0:5c237fdcba23 29
MikamiUitOpen 0:5c237fdcba23 30 FftReal fft_;
MikamiUitOpen 3:7c26b701f363 31 HammingWindow wHm_;
MikamiUitOpen 0:5c237fdcba23 32
MikamiUitOpen 0:5c237fdcba23 33 float Norm(Complex x)
MikamiUitOpen 0:5c237fdcba23 34 { return x.real()*x.real() + x.imag()*x.imag(); }
MikamiUitOpen 0:5c237fdcba23 35
MikamiUitOpen 0:5c237fdcba23 36 private:
MikamiUitOpen 0:5c237fdcba23 37 float* xData_; // data to be analyzed
MikamiUitOpen 0:5c237fdcba23 38
MikamiUitOpen 0:5c237fdcba23 39 virtual void Analyze(const float xn[], float yn[]) = 0;
MikamiUitOpen 0:5c237fdcba23 40 };
MikamiUitOpen 0:5c237fdcba23 41 }
MikamiUitOpen 0:5c237fdcba23 42 #endif // BASE_ANALYZER_HPP
MikamiUitOpen 3:7c26b701f363 43