0
$\begingroup$

I'm using GLSL to do spectral analysis of an input signal. I do the math to associate each pixel (in a single row) with a frequency, then use [The Goertzel Algorithm][1] to determine the contribution of that frequency in the signal.

I'm having a lot of problems with this approach. First, GLSL's float isn't terribly high-precision, and I get a lot of loss of fidelity in the higher frequencies. I'm only going up to about 5kHz here, but you can see how bad the problem is. Eventually, I'd like to get up to 10-15kHz.

[![Ouch][2]][2]

Second, the error margins are massive. To get a reasonable result at typical audible frequencies, I have to sample at least 30-40 cycles of the frequency I'm looking at. This isn't too much of a problem for a 440Hz signal, but 40 cycles of a 27.5Hz (lowest frequency on a piano) is a whopping 52,000 samples!!!

So, I'm getting a crappy result with both the range and the domain of my work. The standard FFT algorithm is no good in GLSL for a number of reasons. Is there any other way I can, in GLSL, get this kind of fidelity?

[![Screen Grab from Voxengo SPAN][3]][3]

[1]: https://www.mstarlabs.com/dsp/goertzel/goertzel.html#:~:text=A%20discrete%20Fourier%20transform%20(DFT,arithmetic%2C%20roughly%20doubling%20the%20efficiency. [2]: https://i.stack.imgur.com/f0FAv.png [3]: https://i.stack.imgur.com/teSr6.png

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.