Created
November 6, 2012 18:44
-
-
Save akx/4026659 to your computer and use it in GitHub Desktop.
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 characters
#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) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment