Seeking a Clear Arduino FHT Code Example

Looking to write (or copy) some code to perform a 64-bin FHT with a Nano for frequency analysis. Want to analyze up to 15KHz signals so a 33.2KHz sample rate seems right. Can’t seem to find a clear code example that explains how to set the number of bins and sample rate, and how to view the resulting frequency bin array.

Also, not clear to me if a 64-bin FHT returns 64 frequency bins or 32 (only half since the other half contains the imaginary bins).

It returns all 64, but there are two bins per frequency so that phase information is not lost - the Hartley transform is invertible.

Perhaps you should consider the DCT? If you're interested in the energy spectrum rather than phase it might be a better natural choice.

For a 64 point transform, only the first 32 frequency bins will contain unique and useful information.

The default sample rate for an Arduino is 9.6 kHz maximum, so you will need to implement custom timer parameters for faster sample rates. This is discussed on the OpenMusicLabs web site.

There is no particular advantage on the Arduino to use an FHT over the FFT.

For single frequency analysis you are better off using the autocorrelation function or the Goertzel algorithm. Both have been used with Arduino.

There is no particular advantage on the Arduino to use an FHT over the FFT.

According to Open Music Labs, the FHT takes half the time to execute as the FFT.

Actually would like to use a DFT or Goertzel algorithm for one particular frequency and an FHT for the remainder of the spectrum. Don't know if the two can coexist in the same code if they need different parameters.

As for DCT, seems that FHT is the preferred algorithm for Arduino. Any particular reason?