void gui_fft_filled () { pthread_mutex_lock(&spectrogram_lock); for (int i = 0; i < FFT_SIZE/2+1; ++i) { spectrogram_buffer[spectrogram_buffer_loc][i] = db_normalize(fft_mag[i], 1, 96); pitch_lp_buffer[spectrogram_buffer_loc] = dominant_frequency_lp; } spectrogram_buffer_loc = (spectrogram_buffer_loc+1)%SPECTROGRAM_LENGTH; pthread_mutex_unlock(&spectrogram_lock); }
int face_run (int argc, char **argv) { printf("%d %s\n", argc, *argv); if (db_normalize () == GEMS_FALSE) { printf (_("Failed to normalize the db")); return GEMS_FALSE; } printf ("\n"); return GEMS_TRUE; }
static void graph_fft_mag (int dbRange) { //fft_mag graph (db, log) glBegin(GL_LINE_STRIP); glColor3f(1.0f,0.0f,1.0f); double logMax = log10(SAMPLE_RATE/2); for (int i = 0; i < FFT_SIZE/2+1; ++i) { double logI = x_log_normalize(i*BIN_SIZE, logMax); double scaledMag = db_normalize(fft_mag[i], 1, dbRange); //max amplitude is FFT_SIZE/2)^2 glVertex3f(2*aspectRatio*logI-aspectRatio, 2*scaledMag-1, 0.f); } glEnd(); }
int face_run (int argc, char **argv) { printf("%d %s\n", argc, *argv); printf ("culling\n"); db_purge_empty (); printf ("Normalizing\n"); if (db_normalize () == GEMS_FALSE) printf (_("Failed to normalize the db")); printf ("\n"); return GEMS_TRUE; }