```
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
```

]]>
Thanks

]]>I have a working windows build here. It’s on my todo list to release very soon but in the meantime feel free to contact me offlist (see my website for email).

The zsa stuff is another possible route.

As for the sigmund code you are looking at the power calculation there. You could calculate the centroid directly from the powerbuf. FWIW – The fft in sigmund~ is taken without window function, as miller applies a von hann window in the frequency domain with a 3 bin convolution (convolution in the freq domain is multiplication in the time domain). If you want windowing) you’ll ahve to do it in the frequency domain otherwise it’ll mess the rest of sigmund’s calculations up. For a von han window I’m sure it’ll change the result by much and possibly not at all, but my brain can’t cope with the maths that would confirm that right now….

It’s pretty gnarly code – so good luck!

Alex

]]>A.

]]>Looking again at the code above I am unclear on whether the power buffer is being calculated for the windowed data or not. The subtracts before the squaring and addition *might* be doing this, but I’d need to look over the sigmund code in a lot more detail to be sure, and figure out the data format of the mayer fft also, which I forget….

A.

]]>Look at my object library there is a centroid~ object, it works on Windows and OsX with fftw. This a beta version but it works.

Pierre Guillot

]]>