diff --git a/src/fft.c b/src/fft.c index 41a7756..06e9f91 100644 --- a/src/fft.c +++ b/src/fft.c @@ -102,7 +102,7 @@ } outputComponents = _fast_ft(inputComponents, inLen); - for(i=0; icount > 0) { @@ -114,14 +114,14 @@ FD_SET(fifo, &set); // allocate buffers used - unsigned int* fftBuf= (unsigned int*)malloc(N_SAMPLES*sizeof(unsigned int)); + unsigned int* fftBuf= (unsigned int*)malloc(N_SAMPLES/2*sizeof(unsigned int)); unsigned int* fftAvg = (unsigned int*)malloc(maxC*sizeof(unsigned int)); cebuffer energyBuffer; cb_init(&energyBuffer, 43); // set the result buffer to 0s - memset(fftBuf, 0, N_SAMPLES*sizeof(unsigned int)); + memset(fftBuf, 0, (N_SAMPLES/2)*sizeof(unsigned int)); memset(fftAvg, 0, maxC*sizeof(unsigned int)); // open connection to mpd and set alarm to refresh status diff --git a/src/settings.h b/src/settings.h index 940c1d6..bba59d0 100644 --- a/src/settings.h +++ b/src/settings.h @@ -8,11 +8,6 @@ // (POWER OF 2) #define N_SAMPLES 2048 -// zero-padding of input samples -// append a number = PADDING*N_SAMPLES of empty samples (0) to the input data -// higher padding -> more precise FFT peak detection (but heavier computational cost) -#define PADDING 4 - // if adaptive sampling should be used // (adjust N_SAMPLES to sample rate of current song) // uses N_SAMPLES as maximum for 44100 Hz