Open Music Labs ArduinoFFT library HELP

I have an Arduino Mega2560 and I want to know how to use the FFT library from Open Music Labs for my board for frequency analysis of sound. Any help on this will be much appreciated.

  1. I will be using an off-the-shelf audio microphone circuit which gives me a voltage o/p in the 0-5V range. Using this I should be able to sample the amplitude v time values of the incoming sound. And, applying a transform like FFT will help me convert the time domain signal to a frequency domain signal. After this conversion, looking at the specific frequency bin and setting a threshold for the occurrence of that frequency, I should be able to confirm the presence of the whistle sound I am looking for. Is my understanding correct on this?
  2. I tried downloading the library files in that site and running the sample programs provided. Upon doing so, I encountered an error which said that it cannot be compiled for the Mega or Mega2560. Even as I changed the boards to Due, Uno etc., the error message kept repeating itself. I don’t think it is the problem with the library as this is one which I found was extensively used. Why am I facing this issue and is there a way I can correct this?

I downloaded the zip file of the FFT library from the below link

http://wiki.openmusiclabs.com/wiki/ArduinoFFT

My gues is that you haven't installed the library correctly. But without seeing YOUR error code it is just a guess. I have used that code myself and it compiles. Use code tags if the error messages are long.

Hey, Mike!

I basically downloaded the library and copied the FFT folder into the libraries folder of the setup file. Am I doing this right? There also seems to be a libraries folder for Arduino created automatically in the 'My documents' folder. Which folder is the one I should be pasting it to?

And, this happened while running the examples in the library. E:\Setup files\arduino-1.6.10-windows\arduino-1.6.10-windows\arduino-‌1.6.10\libraries\FFT‌/FFT.h:181:3: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix] "ldi r16, "STRINGIFY(FFT_N/2)" \n" // prep loop counter ^

E:\Setup files\arduino-1.6.10-windows\arduino-1.6.10-windows\arduino-‌1.6.10\libraries\FFT‌/FFT.h:74:10: error: 'prog_int16_t' does not name a type PROGMEM prog_int16_t _wk_constants[] = { ^

These are the two types of errors being shown.

Please guide me through this if you can. Thank you in advance!

I realized that I had to install the library to the folder in the My documents. Despite doing this, it isn't working.

And, is it necessary that there should be a h and a cpp file in the library? My file doesn't seem to have the cpp file.

Despite doing this, it isn't working.

I just tried it on the new IDE 1.6.12 and it does not compile. These are the error messages:-

Linking everything together...
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-gcc" -w -Os -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p  -o "/var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T/arduino_build_230317/fft_adc.pde.elf" "/var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T/arduino_build_230317/sketch/fft_adc.pde.cpp.o" "/var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T/arduino_build_230317/core/core.a" "-L/var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T/arduino_build_230317" -lm
`_window_func' referenced in section `.text.startup' of /var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T//cc5O033l.ltrans0.ltrans.o: defined in discarded section `.text' of /var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T/arduino_build_230317/sketch/fft_adc.pde.cpp.o (symbol from plugin)
`_window_func' referenced in section `.text.startup' of /var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T//cc5O033l.ltrans0.ltrans.o: defined in discarded section `.text' of /var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T/arduino_build_230317/sketch/fft_adc.pde.cpp.o (symbol from plugin)
`_reorder_table' referenced in section `.text.startup' of /var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T//cc5O033l.ltrans0.ltrans.o: defined in discarded section `.text' of /var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T/arduino_build_230317/sketch/fft_adc.pde.cpp.o (symbol from plugin)
`_reorder_table' referenced in section `.text.startup' of /var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T//cc5O033l.ltrans0.ltrans.o: defined in discarded section `.text' of /var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T/arduino_build_230317/sketch/fft_adc.pde.cpp.o (symbol from plugin)
`_wk_constants' referenced in section `.text.startup' of /var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T//cc5O033l.ltrans0.ltrans.o: defined in discarded section `.text' of /var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T/arduino_build_230317/sketch/fft_adc.pde.cpp.o (symbol from plugin)
`_wk_constants' referenced in section `.text.startup' of /var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T//cc5O033l.ltrans0.ltrans.o: defined in discarded section `.text' of /var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T/arduino_build_230317/sketch/fft_adc.pde.cpp.o (symbol from plugin)
`_log_table' referenced in section `.text.startup' of /var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T//cc5O033l.ltrans0.ltrans.o: defined in discarded section `.text' of /var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T/arduino_build_230317/sketch/fft_adc.pde.cpp.o (symbol from plugin)
`_log_table' referenced in section `.text.startup' of /var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T//cc5O033l.ltrans0.ltrans.o: defined in discarded section `.text' of /var/folders/nw/8ftfyrz54555t_cm5m55kkyr0000gn/T/arduino_build_230317/sketch/fft_adc.pde.cpp.o (symbol from plugin)
collect2: error: ld returned 1 exit status

Looks like it is broken on the new IDE

Is there any chance I can download the older version of the IDE? And, if so which version of the IDE did this compile on, for you? Thank you!

Mike, Thank you so much. I downloaded an older version of the IDE and the program is now compiling. =)

HELLO, I have meet the exactly same problem like yours, how u solve it finally?

Well it is hidden a bit in the last post but basically he:-

abhir24: I downloaded an older version of the IDE and the program is now compiling. =)

The author of the OpenMusicLab FFT routines fixed that problem a few months ago, so if you download the latest version of the library, it should work with the latest version of the Arduino IDE.