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: main.cpp
- Revision:
- 6:b27ef8d98edc
- Parent:
- 5:98ec9dd54144
- Child:
- 7:6598a9b70e5a
--- a/main.cpp Tue Dec 15 13:27:07 2015 +0000 +++ b/main.cpp Fri Dec 18 10:09:31 2015 +0000 @@ -1,9 +1,9 @@ -//----------------------------------------------------------- +//------------------------------------------------ // Realtime spectrum analyzer // Input: A0 (CN5) // -// 2015/12/15, Copyright (c) 2015 MIKAMI, Naoki -//----------------------------------------------------------- +// 2015/12/18, Copyright (c) 2015 MIKAMI, Naoki +//------------------------------------------------ #include "button_group.hpp" #include "Sampler.hpp" @@ -34,9 +34,10 @@ const uint32_t AXIS_COLOR = 0xFFCCFFFF; const uint32_t LINE_COLOR = LCD_COLOR_CYAN; - LCD_DISCO_F746NG lcd; // Object for LCD display - TS_DISCO_F746NG ts; // Object for touch pannel - Sampler input(A0, FS, N_DATA); // Object for sampling + LCD_DISCO_F746NG lcd; // Object for LCD display + TS_DISCO_F746NG ts; // Object for touch pannel + int16_t sn[N_DATA]; // input buffer + Sampler input(A0, FS, N_DATA, sn); // Object for sampling lcd.Clear(BACK_COLOR); @@ -73,11 +74,9 @@ // Wait for "RUN" button touched while (!runStop.Touched(0)) {} - // Start spectrum analyzing + // Start of spectrum analyzing int inv = 0; // 0: "NORM", 1: "INV" int select = -1; - // pointer of data to be analyzed - const int16_t *const sn = input.Get(); while (true) { if (runStop.GetCurrentColor(0) != TOUCHED_COLOR)