Help understanding FFT example

I am trying to use the FFT library to take in a song or sound, fill the frequency bins, and flash LEDs depending on which bins are the most full. I am completely new to arduino and need some help understanding the example that comes with the FFT library I downloaded (ArduinoFFT - Open Music Labs Wiki).

I have a circuit set up that inputs a song’s electrical signals into Analog0. My problem is that regardless of whether or not the song is playing (or even if the circuit it set up or not), the arduino continuously outputs numbers to the serial monitor. So my primary question is: What is inducing this output if nothing is plugged in and how can I fix it? My next question (if I fix it so that I am getting real output) would be: What is the best way to capture the incoming data so I can visualize the bins and make decisions about which LEDs to flash?

I am used to working with matlab so bear with me!

Thanks in advance!

guest 7.7.14
example sketch for testing the fft library.
it takes in data on ADC0 (Analog0) and processes them
with the fft. the data is sent out over the serial
port at 115.2kb.

#define LOG_OUT 1 // use the log output function
#define FFT_N 256 // set to 256 point fft

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

void setup() {
  Serial.begin(9600); // use the serial port
  TIMSK0 = 0; // turn off timer0 for lower jitter
  ADCSRA = 0xe5; // set the adc to free running mode
  ADMUX = 0x40; // use adc0
  DIDR0 = 0x01; // turn off the digital input for adc0

void loop() {
  while(1) { // reduces jitter
    cli();  // UDRE interrupt slows this way down on arduino1.0
    for (int i = 0 ; i < 512 ; i += 2) { // 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
      fft_input[i] = k; // put real data into even bins
      fft_input[i+1] = 0; // set odd bins to 0
    fft_window(); // window the data for better frequency response
    fft_reorder(); // reorder the data before doing the fft
    fft_run(); // process the data in the fft
    fft_mag_log(); // take the output of the fft
    for (byte i = 0 ; i < FFT_N/2 ; i++) { 
      Serial.println(fft_log_out[i]); // send out the data
    //Serial.write(255); // send a start byte
    //Serial.write(fft_log_out, 128); // send out the data

The ADC on the Arduino will return results regardless of whether any input is connected to it. You need to decide when to start and stop sampling.

The way loop() is currently written, it collects 256 samples as quickly as possible, transforms them, prints the results and starts over.

Hi! I am working on a project similar to yours and wanted to know if you figured out how to make this work with yours and if you could post the code. Thanks so much!