Created
November 6, 2012 18:44
Revisions
-
akx revised this gist
Nov 6, 2012 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ #include "kiss_fft.h" #include "kiss_fftr.h" #define FRAMES_PER_BUFFER 2048 -
akx created this gist
Nov 6, 2012 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ #define FRAMES_PER_BUFFER 2048 kiss_fft_cpx freq_data[FRAMES_PER_BUFFER]; kiss_fft_scalar audio_data[FRAMES_PER_BUFFER]; kiss_fftr_cfg fft_cfg; void init() { fft_cfg = kiss_fftr_alloc( FRAMES_PER_BUFFER , 0, 0, 0); } void audio_callback() { // Update audio_data, apply window if required? kiss_fftr(fft_cfg, audio_data, freq_data); // frequency data should be the magnitude (.r * .r + .i * .i) of freq_data[0 .. FRAMES_PER_BUFFER / 2] (where FRAMES_PER_BUFFER / 2 == nyquist frequency) }