void VizWidget::paintGL() { // Clear the buffer with the current clearing color glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); //Update the fft buffer updateFFT(); updateShaders(); // Draw stuff glDrawArrays(GL_QUADS, 0, 4); ++frameCount; }
void printfrequencies() { updateFFT(); for(int i=0; i < FFT_SIZE/2+2; i++) { float_t magn = fft_out[i].i * fft_out[i].i + fft_out[i].r * fft_out[i].r; // amplitude of the signal is the magnitude of the complex number if( magn > 1000) { // realtively low filter for surrounding noise - important constant for analysis Serial.print("number "); Serial.print(i); Serial.print(" frequ: "); Serial.print(i*frequency/FFT_SIZE); // calculate the frequency bin Serial.print(",magn: "); Serial.println(magn); } } }