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
Diff: MyClasses/SpectrumDisplay.hpp
- Revision:
- 0:5c237fdcba23
- Child:
- 4:99d4d5ea06a2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MyClasses/SpectrumDisplay.hpp Wed Dec 09 05:05:00 2015 +0000 @@ -0,0 +1,47 @@ +//------------------------------------------------------- +// Class for display spectrum (Header) +// +// 2015/12/07, Copyright (c) 2015 MIKAMI, Naoki +//------------------------------------------------------- + +#ifndef SPECTRUM_DISPLAY_HPP +#define SPECTRUM_DISPLAY_HPP + +#include "LCD_DISCO_F746NG.h" + +namespace Mikami +{ + class SpectrumDisplay + { + public: + SpectrumDisplay(LCD_DISCO_F746NG &lcd, + int nFft, int x0, int y0, + float db1, int bin, float maxDb, int fs, + uint32_t axisColor, uint32_t lineColor, + uint32_t backColor); + void Draw(float db[]); + void Clear(); + + private: + + const int N_FFT_; // number of date for FFT + const int X0_; // Origin for x axis + const int Y0_; // Origin for y axis + const float DB1_; // Pixels for 1 dB + const int BIN_; // Pixels per bin + const float MAX_DB_; // Maximum dB + const int FS_; // Sampling frequency: 10 kHz + const uint32_t AXIS_COLOR_; + const uint32_t LINE_COLOR_; + const uint32_t BACK_COLOR_; + + LCD_DISCO_F746NG& lcd_; + + void AxisX(); // x-axis + void AxisY(); // y-axis + + void DrawString(uint16_t x, uint16_t y, char str[]) + { lcd_.DisplayStringAt(x, y, (uint8_t *)str, LEFT_MODE); } + }; +} +#endif // SPECTRUM_DISPLAY_HPP