What is 'spectrum' anyway? How can multiple frequencies exist in one signal?

Listen up. Go read the FFT link in the Libraries section and follow the links there. There is one really very good analysis in there for a newby.
If you want some free ebooks, "The Scientists and Engineers guide to DSP" is available as a free download, but you need some Pure Math to get thru it.
Take a look at the Elektor DSP project board that started in Nov 2011, (I think).
I don't know what you're engineering background is, but for Gawd's sake get started. DSP is the last challenge left in life.

greywolf271:
Listen up. Go read the FFT link in the Libraries section and follow the links there. There is one really very good analysis in there for a newby.
If you want some free ebooks, "The Scientists and Engineers guide to DSP" is available as a free download, but you need some Pure Math to get thru it.
Take a look at the Elektor DSP project board that started in Nov 2011, (I think).
I don't know what you're engineering background is, but for Gawd's sake get started. DSP is the last challenge left in life.

Which project board do you mean? This one (currently sold out) http://www.elektor.com/products/kits-modules/modules/100126-91-elektor-dsp-radio.2210480.lynkx or a different one?

OK, I get it, it must be http://www.elektor.com/magazines/2011/may/audio-dsp-course-(1).1778257.lynkx

Weird, the chip they use is "Not Recommended for New Design" and no one on findchips.com sells it. Not popular for some reason.

Samples are available! :grin:

If you want to play with spectral analysis, you don't need an expensive controller board.
You should be able to code an FFT on an Arduino UNO and sample an audio signal using
an A/D channel.

I don't know where greywolf was referring to, there must be some FFTs somewhere on the
Arduino site. They probably won't be especially fast [like on a super fast DSP chip], but will be
fun to play with. You can make a display similar to those I linked to first post, but a little
simpler.

Oric and Joe,
the Arduino lib link is {Reference -> libraries -> Contributed Libraries -> Audio and Waveforms. Then look in FFT.
Open Music labs has done some great work. The interesting source code is in assembler, because the standard libraries are too slow.

If you look in the one of his links to http://www.alwayslearn.com/, this is the other "learning link" I was referring to.

Another useful page is DSP Guru. Just google it.

Y'all forgot about the most common, and easily analyzed bit os spectrum out there. Its called LIGHT. Amixture of many frequencies that are present in various amounts at various times. And the highly specialized recieving equipment that allows us to analyze it is our eyes.

And a spectrum anayzer gnerally is a combination sweep tuned reciever and sweep tuned filter where the signal is captured for relative intensity (or strength) and that relative intensity is displayed. They are actually quite simple devices in theory, but it does take some work to get the wide frequency range for both the reciever and filter...

Look at karplus strong, FM Additive and subtractive synthesis... Quite mathematical, but in in discrete time systems is somewhat simplified a bit, as you have a lot of tricks you can do , bit wise, to avoid too many computing power to multiplications and complex equations... Best is to go same way most do, when it comes to sound synthesis in uC's : Wavetables, though the DUE already does a lot ( i been playing with it as im working on something similar !

/* Discrete Computational Methods */

    

 
// variables accessed by the interrupt 
volatile byte adc;
volatile byte out_sign;
volatile boolean l;
 
  float pi = 3.141592;
  float w ;    // ?
  float yi ;
  float phase;
  int D = 1024;
  byte sign_samp;
  byte sin_data[1024];  // sine LUT Array 
  int icounter;
  int counter2;
  int testPin = 13;      // debugging pin digital pin 13
  int testPin2 = 12;      // debugging pin digital pin 12 
  int testPin3 = 11;      // debugging pin digital pin 11
  int testPin4 = 10;      // debugging pin digital pin 11
  float a;
  float b;

void setup()
    { 
      fill_sinewave();       // load memory with sine table
      pinMode(testPin,OUTPUT);
      pinMode(testPin2,OUTPUT);
      pinMode(testPin3,OUTPUT);
      pinMode(testPin4,OUTPUT);
      startTimer(TC1, 0, TC3_IRQn, 0x8000); //TC1 channel 0, the IRQ 
      // for that channel and the desired frequency - 32768 -see somewhere 
      // else for the reason why
      analogWrite(DAC0,0);  //Duane B// this is a cheat - enable the DAC
    }

void loop()
    {
      counter2++;           // 
      if (counter2 >= 0x400)
        {   
          digitalWrite(13, l = !l); // toggle debugging pin on pin 13   
          counter2=0;
          fill_sinewave();
        }
      adc=analogRead (0);  // get the adc 
      b=analogRead(1);     // get the adc 2
         if(b<=511)
          {  
            b=b*pi/128;
          }
      else if (b>=512)
          { 
            b=b*pi/1024;
          }
      if (adc<=249)
          {
            a=2;
          }
      if (adc>=250 && adc<=511)
          {
          a=4;
          }
      if (adc>=512 && adc<=750)
          {
            a=6;
          }
      if (adc>=851 && adc<=1024)
          {
            a=8;
          }          
      digitalWrite(12, l = !l);     // toggle debugging pin on pin 12 
    }
    /*
* Here is the table of parameters: *
  ISR/IRQ TC      Channel Due   pins
  TC0 TC0 0 2,      13
  TC1 TC0 1 60,     61
  TC2 TC0 2 58
  TC3 TC1 0 none  <- this line in the example above
  TC4 TC1 1 none
  TC5 TC1 2 none
  TC6 TC2 0 4, 5
  TC7 TC2 1 3, 10
  TC8 TC2 2 11, 12
*/

void startTimer(Tc *tc, uint32_t channel, IRQn_Type irq, uint32_t frequency) {
  pmc_set_writeprotect(false);
  pmc_enable_periph_clk((uint32_t)irq);
  TC_Configure(tc, channel, TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | TC_CMR_TCCLKS_TIMER_CLOCK1);
  uint32_t rc = VARIANT_MCK/8/frequency; //8 because we selected TIMER_CLOCK1 above
  TC_SetRA(tc, channel, rc/2); //50% high, 50% low
  TC_SetRC(tc, channel, rc);
  TC_Start(tc, channel);
  tc->TC_CHANNEL[channel].TC_IER=TC_IER_CPCS;
  tc->TC_CHANNEL[channel].TC_IDR=~TC_IER_CPCS;
  NVIC_EnableIRQ(irq);
}
// TC1 ch 0  
void TC3_Handler()
    {
      digitalWrite(10, l = !l);    // toggle debugging pin on pin 10 
      TC_GetStatus(TC1, 0);
      icounter++;                  // increment index
      //icounter=icounter + b;         // Variable frequency with potentiometer
      icounter = icounter & 0x3ff;         // limit index 0..1023
      if( icounter==0x400)
        {
          icounter=0;
        }
      out_sign=sin_data[icounter]; 
      dacc_write_conversion_data(DACC_INTERFACE, out_sign);  
    }
   
       /*  Plotting Complex Sinusoids as Circular Motion  */
             /*             */
/* Euler's relation graphically as it applies to sinusoids. A point 
traveling with uniform velocity around a circle with radius 1 may 
be represented by  */ 
       /* ei? = cos(?) + i*sin(?) */
            /*   e?t=e?ft    */
/* in the complex plane, where: 
  t is time and  is the number of revolutions per second.           
  e is Euler's number, the base of natural logarithms,
  i is the imaginary unit, which satisfies i2 = ?1, and
  ? is pi, the ratio of the circumference of a circle to its diameter.
(1) http://en.wikipedia.org/wiki/Sound
(2) http://en.wikipedia.org/wiki/Sound_frequency
(3) http://en.wikipedia.org/wiki/Sine_wave
(4) https://ccrma.stanford.edu/~jos/Welcome.html
(5) http://lionel.cordesses.free.fr/gpages/DDS1.pdf
*/
void fill_sinewave()
    {
      digitalWrite(11, l = !l);  // toggle debugging pin on pin 11 
      w= a*pi;
      w= w/512;  // sine LUT Array D= ox8000(fs)@32Hz. use 512,as is@  64Hz(my methods to measure it were limited, so maybe someone can do it for us ?!)   The shape of the stored waveform is
  // arbitrary, and can be a sinusoid, a square, sawtooth, etc
      // fill the 1024 byte circular ring buffer array
      for (D = 0; D <= 0x3ff; D++)
        {
          yi= 0x7f*sin(phase);   // try yi= 0x7f*sin(phase)-(2*cos(phase)); 
//  increase to 3 ? yi= A*sin(phase)- cos(phase)- cos(phase)- cos(phase);
          phase=phase+w;         // 0 to 2xpi - 1/1024 increments
          sign_samp=0x7f+yi;     // dc offset
          sign_samp+= b;         // Add adc value; Keep it at zero for pure sine
          sin_data[D]=sign_samp; // write value into array
      /*
      */      
        }
      digitalWrite(11, l = !l);  // toggle debugging pin on pin 11 
    }

Based on several ideas from KHM labs experiments and Duane B.
Code if far from clean ( as i said, an ongoing project, and its the only version i have available here...) but sharing it in case it useful to anyone. Id still choose the one at Duane's as a building block if you wanna take it further... I just wanted to implement and "port" the KHM version through in order to understand the implementation in the practical side by... (what else?) Doing it !!
Duane actually has a nice option there with grain based synthesis and someone done a nice rework with it to make it variable ( The code i have there is just the basic building block of the oscillator, as ill keep sharing some more as i go on). But deffo heavy math in it !

As it didnt allow me to put it all, here is the rest...

/* Generating/Sample discrete sinusoid */ 
           
/* Direct digital synthesis is a common technique for generating 
waveforms digitally. The principles of the technique are simple and 
widely applicable. You can build a DDS oscillator in hardware or in 
software.
A DDS oscillator is sometimes also known as a Numerically-Controlled 
Oscillator (NCO). Usually we use a Circular buffer or FIFO.
The NCO function contains a sine look-up tables (LUTs) that perform 
the following functions:
sin(n) = sin(2?n/N)
where:
n = Address input to the LUT
N = Number of samples in the LUT
sin(n) = Amplitude of sine wave at (2?n/N)

Incrementing n from 0 to N causes the LUT to output one complete 
cycle of amplitude values for the sine  function. The value 2?n/N 
represents a fractional phase angle between 0 and 2?. The time (t) 
required to increment n from 0 to N is the period of the sine  
waveforms produced by the NCO function.

The LUT address is incremented once each system clock cycle by an 
amount equal to the phase input. The phase angle data is accumulated 
and stored in the phase accumulator register. The output of the 
phase accumulator register is used to address the LUTs.
The frequency (f) of the system clock (fCLK) is fixed. Therefore, 
the frequency of the sine waves is:
f = 1/t = fCLK × phase/2?. */
            /*  Table Lookup */
 /*The table look-up method precomputes the unique samples of every 
 output sinusoid at the start of the simulation, and recalls the 
 samples from memory as needed. Because a table of finite length 
 can only be constructedif all output sequences repeat, the method 
 requires that the period ofevery sinusoid in the output be evenly 
 divisible by the sample period. That is, 1/(fiTs) = ki must be 
 an integer value for every channel i = 1, 2, ..., N. 
 The table that is constructed for each channel contains ki elements.
 For long output sequences, the table look-up method requires 
 far fewer floating-point operations than any of the other methods, 
 but may demand considerably more memory, especially for high 
 sample rates (long tables). This is the recommended method 
 for models that are intended to emulate or generate code for DSP 
 hardware, and that therefore need to be optimized for execution speed.*/
       /*  Differential */  
 /* The differential method uses an incremental (differential) algorithm 
rather than one based on absolute time.
This mode offers reduced computational load, but is subject to drift 
over time due to cumulative quantization error.
Because the method is not contingent on an absolute time value, 
there is no danger of discontinuity during extended operations (when 
an absolute time variable might overflow). */
        /* Trigonometric Function */    
 /*  If the period of every sinusoid in the output is evenly divisible 
 by the sample  period, meaning that
1/(fiTs) = ki is an integer for every output yi, then the sinusoidal 
output in the ith channel is a repeating sequence with a period of  
ki samples. At each sample time, the block evaluates the sine function 
at the appropriate time value within the first cycle of the sinusoid. 
By constraining trigonometric evaluations to the first cycle of each 
sinusoid, the block avoids the imprecision of computing the sine of 
very large numbers, and eliminates the possibility of discontinuity 
during extended operations (when an absolute time variable might 
overflow). This method therefore avoids the memory demands of the table
look-up method at the expense of many more floating-point operations. */
               /*  - THE CODE -  */
/*Used the proverbial timer interrupt example code, and 
the old techniques on Direct digital synthesis available at 
places like
http://interface.khm.de/index.php/lab/experiments/arduino-dds-sinewave-generator/
or 
http://rcarduino.blogspot.co.uk/2012/12/arduino-due-dds-part-1-sinewaves-and.html
*/

What is 'spectrum' anyway?

A spectrum is a range of frequencies that is emitted or absorbed by a something.

How can multiple frequencies exist in one signal

The can.
The OP seems to think that all waves are electro magnetic. They are not. Most signals in wires are simply electric.

A frequency is something that repeats over time. However it is not defined by a single voltage point at any instant. The lowest frequency is defined as the period where a signal describes a complete sequence, such that you could take that period, shift it in time by exactly one period and the past wave shape would line up exactly with the future wave shape.

That is just the lowest frequency or fundamental. If that is a sin or cos shaped wave that is all there is to it, if not there is more than one frequency present in that signal. Any wave shape can be created by a sum of sin and cos waves at different amplitudes and frequencies. These frequencies are harmonically related to the fundamental being integer multiples of it.

Mike is the man to ask. Im just a student... Actually was the maths in dsp that got me more interested in using maths to solve simple things in real time circuits without recurring to the simulator lol The perks !