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
MyClasses/Sampler.hpp
- Committer:
- MikamiUitOpen
- Date:
- 2015-12-18
- Revision:
- 6:b27ef8d98edc
- Parent:
- 4:99d4d5ea06a2
- Child:
- 7:6598a9b70e5a
File content as of revision 6:b27ef8d98edc:
//------------------------------------------------ // Class for sampling input signal (Header) // // 2015/12/18, Copyright (c) 2015 MIKAMI, Naoki //------------------------------------------------ #ifndef F746_SAMPLER_HPP #define F746_SAMPLER_HPP #include "mbed.h" namespace Mikami { class Sampler { public: Sampler(PinName pin, int fs, int nData, int16_t* const buffer); void IntrEnable(); bool Filled() { return filled_; } void Restart() { filled_ = false; } void InvertEnable(bool onOff) { sw_ = onOff ? 1 : 0; } private: const int TS_; // sampling period const int N_DATA_; // number of 1 frame data AnalogIn aIn_; // Object of ADC Ticker timer_; // Object of Ticker bool trigger_; bool filled_; int count_; int16_t xnM1_; int sw_; int16_t* const buffer_; // for sampled data // For input int16_t (Sampler::*Rd[2])(); int16_t ReadNorm() { return aIn_.read_u16() - 32767; } int16_t ReadInv() { return 32767 - aIn_.read_u16(); } void Set(bool tf); // Interrupt service routine for Ticker void Isr(); // disallow copy constructor and assignment operator Sampler(const Sampler& ); Sampler& operator=(const Sampler& ); }; } #endif // F746_SAMPLER_HPP