# Extract frequencies from PCM signal

I have an PCM (pulse-code modulation) signal. If I want to work out the frequency of a sample $x$ long, I count the number of peaks/troughs of the sample, and divide by $x$. The equivent dB of frequencies $20Hz > 20 000 Hz$ is then just the equivelent dB of the signal as a whole

However, I would like to create a spectrum analyzer of the type shown below. This requires extracting the equivelent decibels of different frequencies in the signal. So I need to split the signal into different signals of different frequencies, so I have signals of $20Hz > 5000Hz$, $5000Hz > 10000Hz$, $10000Hz > 20000 Hz$, ect.

How can I extract signals for the different frequencies from one master signal?

-

It is not clear if you want to visualize the signal or process/transform it ("graphic equalizer" is an effect/transformation adjusting the signal level independently in various frequency bands, not a visualization - a more correct term for the representation you posted an image of is "spectrum analyzer").

It is not clear if you are working in the analog domain or the digital domain, and what kind of technology you want to employ (analog electronics? computer code running on a DSP chip or microcontroller? on a desktop computer?).

Are your signals audio signals? In which case you have to be aware that a meaningful representation should display the 20 Hz .. 20kHz range (range of human hearing), and that it should be subdivided logarithmically.

To get this kind of visualization, there are two solutions:

• A bunch of band-pass filters (and a low-pass + a high-pass for the lower and higher channels). You then measure the (log-) energy in each band to get the "height" of each bar. This can be done in the analog domain (a bunch of op-amps for the filter, a rectifier to measure the signal level, and a log-amplifier to get the energy on a log scale; or with dedicated ICs like the MSGEQ7); or in the digital domain with digital filters.
• A FFT + some grouping of adjacent bins (which is more or less equivalent to computing the filter bank in the frequency domain). Note that this can only be used for digital signals.
-
Thankyou. Sorry, for being unclear, I'm new to all of this. It is a PCM signal (I have cleared this up in the question), and a desktop computer. And, yes it is audio, (I am aware of the 20 > 20k range, the numbers I gave were just off the top of my head random numbers) –  ACarter Jan 11 '13 at 20:07

The signal is PCM data, so an FFT algorithm is appropriate (as already mentioned above). There are lots of shareware applications that do this, so unless you are interested in the thrill of developing such an app, search for something like "pc spectrum analyzer". If you want to develop the app, you probably want to find some libraries that provide canned signal processing algorithms. Again you can search and find such things without much difficulty. Perhaps other users can offer up references to libraries that they have used.

-