FHT do'est work with the example code

I’m trying to use the FHT librairy from (ArduinoFHT - Open Music Labs Wiki). I used the example code provided on the link, which is the following :

#include <FHT.h> // include the library

#define LIN_OUT8  1
#define FFT_N     64

void setup() 
  /*Turn off timer0 for lower jitter - 
    delay() and millis() killed*/
  TIMSK0 = 0;
  /*set the adc to free running mode*/
  ADCSRA = 0xe5;
  /*use adc0*/
  ADMUX = 0x40;
  /*turn off the digital input for adc0*/
  DIDR0 = 0x01;


void loop() 
  { // reduces jitter
    cli();  // UDRE interrupt slows this way down on arduino1.0
    for (int i = 0 ; i < FHT_N ; i++) 
    { // save 256 samples
      while(!(ADCSRA & 0x10)); // wait for adc to be ready
      ADCSRA = 0xf5; // restart adc
      byte m = ADCL; // fetch adc data
      byte j = ADCH;
      int k = (j << 8) | m; // form into an int
      k -= 0x0200; // form into a signed int
      k <<= 6; // form into a 16b signed int
      fht_input[i] = k; // put real data into even bins
    fht_window(); // window the data for better frequency response
    fht_reorder(); // reorder the data before doing the fft
    fht_run(); // process the data in the fft
    fht_mag_lin8(); // take the output of the fft
    Serial.write(fht_lin_out8, FHT_N/2);

But I get the following error:
’fht_lin_ou8’ was not declared in this scope

Does anyone have an idea ?

I can’t find an example on that website which uses fht_mag_lin8. Where did you get that code from?

I think you have to declare the array fht_lin_out8. Immediately after “#define FFT_N 64” add:

unsigned char fht_lin_out8[FFT_N/2];

and delete the line:


[edited]Thanks @jremington for pointing out the typo (was fht_lin_ou8).

You have a typo in the array name. From the FHT documentation:

fht_mag_lin8() - This gives the magnitude of each bin in the FHT. It sums the squares of the imaginary and real parts, and then takes the square root, rounding the answer to 8b precision (it uses a lookup table, and scales the values to fit the full 8b range. It takes no variables, and returns no variables. It operates on fht_input, and returns the data in an array called fht_lin_out8. You can then use the data in fht_lin_out8.