Holiday notice: Cycling '74 will be closed Monday, October 9th. Manual authorization, support cases, and manual order processing will be delayed.

Feb 06 2012 | 2:08 am

Hi there, in the interests of speed I want sigmund~ to output the spectral centroid. Looking at the sigmund~ code, I'm having a bit of difficultly working out where to inject the code, because almost none of it is commented. So basically I'm looking for an array of the results of the FFT, so I can take the weighted average of the bins. I think it might be here but I'm not sure. Can someone who knows the object more confirm this? Cheers.

`mayer_realfft(npts2, bigbuf); for (i = 0; i < npts; i++) rawreal[i] = bigbuf[i]; for (i = 1; i < npts-1; i++) rawimag[i] = bigbuf[npts2-i]; rawreal[-1] = rawreal[1]; rawreal[-2] = rawreal[2]; rawreal[-3] = rawreal[3]; rawreal[-4] = rawreal[4]; rawimag[0] = rawimag[npts-1] = 0; rawimag[-1] = -rawimag[1]; rawimag[-2] = -rawimag[2]; rawimag[-3] = -rawimag[3]; rawimag[-4] = -rawimag[4]; #if 1 for (i = 0, fp1 = rawreal, fp2 = rawimag; i < npts-1; i++, fp1++, fp2++) { float x1 = fp1[1] - fp1[-1], x2 = fp2[1] - fp2[-1]; powbuf[i] = x1*x1+x2*x2; } powbuf[npts-1] = 0; #endif`