Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: F746_GUI F746_SAI_IO FrequencyResponseDrawer SD_PlayerSkeleton UIT_FFT_Real
Diff: MySpectrogram/FFT_Analysis.cpp
- Revision:
- 0:224dccbc4edd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MySpectrogram/FFT_Analysis.cpp Mon Aug 15 07:18:07 2016 +0000 @@ -0,0 +1,23 @@ +//------------------------------------------------------- +// Class for spectrum analysis using FFT +// +// 2016/07/23, Copyright (c) 2015 MIKAMI, Naoki +//------------------------------------------------------- + +#include "FFT_Analysis.hpp" + +namespace Mikami +{ + FftAnalyzer::FftAnalyzer(int nData, int nFft) + : AnalyzerBase(nData, nFft, nFft), + yFft_(nFft/2+1) {} + + void FftAnalyzer::Analyze(const float xn[], float yn[]) + { + fft_.Execute(xn, yFft_); // Execute FFT + + // Translate to dB + for (int n=0; n<=N_FFT_/2; n++) + yn[n] = 10.0f*log10f(Norm(yFft_[n])); + } +}