spectrum analyser

Marktalbot used Ask the Experts™
i have to write some software to display an analog wave form sample though the serial port. I want to now how to display this in the form of a spectrum analyser.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Which control are you using to display the wave. If you are not using any control, you can use Olectra Chart.
Are you asking if there is a "spectrum analyser" control or are you asking how to draw on a form?

If it's the latter you use
Form.Line (X1, Y1)-(X2, Y2)
If you are looking for code to do FFT and other DSP stuff, this is not going to be the answer.  If, however, you are just trying to display the waveform on-screen, then checkout:


Look for the sample called Playing and Displaying Wave Data.  Granted, they are taking the waveform data from a .WAV, but it isn't too difficult to change to serial input.  However, their plot is with fixed data (the size of the data is static) so changing it to dynamic data would be more involved.

Good luck.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!


i can draw the wave to the screen but a want to be able to display not in the form of an ossiloscope trace but as a nuber of lines repreenting the aplitude of a specific frequency

I know I've seen VB Algorithm books with FFT.  You might want to check out:

I know there are other sites out there with this stuff, but that is what I found first.
Then how about

Form.Line (X1, Y1)-(X1, Y2)

that draws vertical lines.

The simplest way of plotting a chart is to create an array of numeric values, and then set the ChartData property to the array, as shown in the following example:

' This code might be pasted into the Load event
' of a Form that has an MSChart control named
' "MSChart1".
Dim arrPrices(1 to 10)
Dim i As Integer
For i = 1 to 10
   arrPrices(i)= i * 2
Next i
MSChart1.ChartData = arrPrices


My suggestion would be to find out what a good program that provides a spectrum analysis looks like.  I highly recommend checking out www.spectraplus.com  The have a trial 30 day version that will show you in real time in both time, freq and freq over time displays of audio coming into your system (e.g. mike, CD, line in,...)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial