Solved

Spectrum Analizer-up to 500 pts.!!!

Posted on 1998-04-12
34
436 Views
Last Modified: 2010-04-06
Hello dear experts,

first thing: POINTS CAN INCREASE UP TO 500!

I want to make a spectrum analizer (those bouncing bars on the lcd screen of a CD player or the stereo system?)
In other words: I need to know the current peak in some frequencies (5 or more) when some device is making sound through the sound card (windows 95 of course)

I have no info to start with at all, so if you know any small detail then please post it!
-And another thing, never worked with sound before, and I understand just some litle things about it...

If you don't know the full answare then please post a COMMENT, and please try to post thigs written in Delphi.

The biggest thanks in the world!!!

Kind regards,
Matvey (bosism@netvision.net.il)
0
Comment
Question by:MB122897
34 Comments
 
LVL 14

Expert Comment

by:smeebud
Comment Utility
MB,
I don't have a clue. But I have found that deja news
http://www.dejanews.com/home_ps.shtml

If entering the right "Search Phrase" will produce more than you may expect/

Good luck
Bud
0
 
LVL 22

Expert Comment

by:nietod
Comment Utility
To get the frequency information, you must use a fourier transform.  Many of numerical algorithm books out there will have algorithms for fourier transforms.  You probably want to use a FFT or Fast Fourier Transform, because you will need to perform the transform repeatidly and a quckly as possible.
0
 

Author Comment

by:MB122897
Comment Utility
smeebud - thanks, I'll try this.

nietod, I don't understand what do you mean. Do you understand what I want to do? You must have seen those bouncing bars, or whatever else in the music devices like CD players, I mean some visualization of the sounds that corresponds to a wave peak or something like that... (also lights of the disco...)
0
 
LVL 14

Expert Comment

by:smeebud
Comment Utility
I suggest you post a detailed question to
comp.os.ms-windows.programmer.win32

Bud
0
 
LVL 22

Expert Comment

by:nietod
Comment Utility
How do you know how high the bars should be at a particular time?  

Each bar represents magnitude of a range of frequencies that comprise the signal. The only way to get that information is with a fourier transform--and it won't be easy!
0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
easy? I'm quite sure it's not... :-)

Please tell me what is fourier transform?
0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
Smeebud, what is the address?

comp.os.ms-windows.programmer.win32

I can't enter there...
0
 
LVL 9

Expert Comment

by:rmarotta
Comment Utility
MB,
A spectrum analyzer is a graphical representation of the relative magnitude of a signal compared with those that may surround it within a certain range.
Are the signals of interest for you in the audio frequency spectrum?
If so, there are a number of programs that can generate the desired output for you on a PC.
Let me know if this is what you want, and I'll post an answer.
Regards,
Ralph

0
 
LVL 1

Expert Comment

by:Nexial
Comment Utility
A quick alta vista search using
    <+"spectrum analyzer" +"source code">
produced 324 documents.   Of the first 20 that I looked at,
at least ten referred to program code in an assortment of
languages.
                                                       
0
 
LVL 15

Expert Comment

by:jrhelgeson
Comment Utility
There is one of those that comes  with the Creative Labs Sound Blaster 64 GOLD.
0
 

Expert Comment

by:tmcgough
Comment Utility
As has been stated in previous comments, there are some freeware analizers already out on the net. It might be easier to disect or use one of them due to the one key prolem.  Unless you know how to do fourier analysis formulas you are not going to get what you want.  I was thinking about doing this once with my sound card and after looking around it seems that this was the only answer.  Although I was working with an MWAVE DSP chip instead, I am sure the ideas would be the same.  

I hope you the best whatever you decide to do.

0
 
LVL 3

Expert Comment

by:KE
Comment Utility
You will also need to look at the direct X technologies if you plan to make a device independent sound interface. With direct X you should be able to monitor the line-in of a sound device (digitally).
0
 
LVL 22

Expert Comment

by:nietod
Comment Utility
Try the following web site for C++ code for fourier transforms.

http://cfatab.harvard.edu/nr/bookcpdf.html
0
 
LVL 5

Expert Comment

by:inter
Comment Utility
Hi friends,

If my interpretation is not wrong this question has two aspects:
1 - Analyzing a given sequece periodically (not hard)
2 - Get that sequence from the sound device driver (thats hard)
Matvey, do you want to make a sound monitoring program? If you only want to display that analyzer when YOUR program plays the tune it is not hard. But if you want to monitor every program that generates sound thats problematic. We should write a Pseudo sound driver on top of the existing driver so that all the data should flow from our driver. Give additional info please.

In any case:
1 - FT : Fourier Transform is a transform that transforms and input signal into Frequecy Domain. The frequency domain sequence is composed of Complex numbers which carry Magnitude and Phase information. Basically from frequency domain we can see that how the input signal varies interms of its frequecy components. The original FT is continuous time process.
2 - DFFT - Discrete time and Fast transform that we get input samples as binary digits with a sampler(e.g. AD converter ). By fast transform we mean that it is time complexity if logaritmically proportional with the number of elements.

Waiting for your comments,
(I have already made a full spectrum monitor, for random samples, but the problem is how to monitor real samples for sound card!)
Igor
0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
Whow!!! thanks for so many comments!

inter: "Matvey, do you want to make a sound monitoring program?"
-Nop, sorry, this is the first time, and I even know very very little about working with sound.

"If you only want to display that analyzer when YOUR program plays the tune it is not hard"
-Yes, I don't need it to monitor other programs too, and it's really great if it's not hard!
BUT, I need it not only for wave files, or any other files, but also for CD ROM sound output through the sound card.
Inter, do you mean you already have made something like this? -It's great!

nietod, thanks for the link, but as far as I understand from Igor's comment, this is not the end product (??). Maybe we can get it working for us?

KE, I haven't done anything with DirectX either - maybe you can tell me more too, eh?

jrhelgeson, jrhelgeson, it's great if it's already fully done by someone! First of all you can send me whatever you have there (bosism@netvision.net.il), but are you sure it can analise any output like also CD ROM sound output through the card?

Nexial, I'll be sure to check this too!

rmarotta, I think you understood what I need (graphical representation...), you can send me the stuff you have, but I don't think you should post an answare right now - be sure you get the points if it works well! :-)

I also want to add that I've seen an application, that seems NOT to use MCI and DirectX, and it whows a good spectrum ananlizer (through windows of course)... I'm not sure how it works...

Thanks again for comments, and please try to help me more!

Matvey
0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
Ooops, inter, sorry!

"Matvey, do you want to make a sound monitoring program?"
-Yes, but I don't have a clue how to do this...

Sorry - stupid mistake...
0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
Well, seems I enter a little bit late in this thread.... I'll see what I can do ...
Inter, seems that you've done already everything, spectrum analyzer, .....
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 5

Expert Comment

by:inter
Comment Utility
Yes friend,

But Matvey need a little bit more. He wants to monitor sounds played on Windows which may require some pseudo device driver stuff. I can not figure out, how to do it without getting into trouble. If you have an idea or code how we can get the samples of an audio(it is easy if we have it in XXXX.wav, but Matvey want even track to the CDs when playing native digital music) we may combine them to make great puplic stuff.

Regards,
Igor
0
 
LVL 9

Accepted Solution

by:
rmarotta earned 250 total points
Comment Utility
MB, Matvey, Inter, ?
The answer to your problem can be found here:

http://www.pmgrp.com/prod01.htm

Good luck,
Ralph

0
 

Expert Comment

by:RLM
Comment Utility
I'm author of SuperSonic, http://www.gosupersonic.com

Is this similar to what you're trying to accomplish?

-Rob
0
 
LVL 1

Expert Comment

by:hotsextoy
Comment Utility
hmm, guys he's a beginner...so an EASY way and qwick way (if there is such a thing), is to use MCI commands...Use Audio Mixer Controls and i beleive u can use the fader control types such as (Bass, Treble, Fader, Volume, and EQUALIZER), this should return values between 0 and 65,535) and u can uses these values and represent them any text or graphical way u want...The key thing here is the number of equalizer bands and their particular limits are hardware dependant...but a way to find all that out is use the MIXERCONTROLDETAILS_LISTTEXT structure to find out the labels for the varius equalizer controls...i think this is the easiest way i can think of...there are many more obviusly but this should be simple to understand (without math algorithms) and easy to implement...if u want specifics, u betta dish out the points my way...
                                                                                                            Pat b
 
0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
Hope you can forgive my week delay... -I had to give my computer for a fix...
-Very, very sorry... :(

I don't think that MCI supports such stuff directly - if it does, then it's well hidden.

Anyway, if SOMEONE of you knows SOMETHING, then the best thing to do is to eMAIL me.

sexboy, that includes you too - if you can send me some peice, or put into some clear words the things you know, then please feel very, very free to do it...
btw I'm not a beginner to programming, but a begginner to sound...

RLM, have to check it right away...

rmarotta, also thank's, checking it right out...
0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
Yahoo!

rmarotta, RLM, this is the stuff I need!

But how do we get it into Delphi?

Other experts, if it's not a big deal for you to get 2MB, then get it!
http://www.pmgrp.com/prod01.htm
0
 

Expert Comment

by:RLM
Comment Utility
hotsextoy: Although MS documents mixer API as supporting a control EQUALIZER, this is for hardware manufacturers who wish to develop a hardware equalizer and need an API to support it. I don't know of any sound card that includes an EQ and even if anyone did, reading values from this control wouldn't give you a spectrum analyzer, it would give you the current locations of the control EQ sliders. There are some METER controls on one or two sound cards out there that will return limited information about audio passing through card but that's about it.

Matvey: DirectX doesn't offer any advantages to creating a spectrum analyzer. In fact, if this is all you want to do, it will certainly make it more difficult since its API is much more complex. When playing wave file data, you simply send frames of audio data to your spectrum analyzer FFT routine at regular intervals. The FFT routine analyzes the data and stores the output which you use for drawing your analyzer. When not playing wave data, you simply record audio using waveIn and send the incoming frames of audio data to your FFT routine. FFT's are kinda slow in realtime so I wrote a proprietary algo for calc'ing my spec analyzer, since when I originally wrote it, the fastest machine available was a 486/66.
0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
Ooops, RLM forgot that you are the one that made it!

-I keep repeating myself and saying that I don't really understand what FFT is, how to use it, etc.

I must admit that the other thing that rmarotta posted (http://www.pmgrp.com/prod01.htm) works faster than the analizer in SuperSonic, so you better check it out too.

Well, of course speed is very important, but now we have something to start with!

So RLM, maybe we can share some code?

rmarotta, do you know more about the stuff you told and about the author?
0
 
LVL 9

Expert Comment

by:rmarotta
Comment Utility
MB,
Only that the programs are ready to go, and will do whatever you want with audio!
You're better off contacting them for more info.
Regards,
Ralph

0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
nietod,

Really sorry for I didn't refer to you last time. I've downloaded all the files about the FFT that there are in the site you posted. I'm going to read it, and I hope to understand at last what it is!

Big big thanks!

Please keep in touch.
0
 
LVL 5

Expert Comment

by:inter
Comment Utility
Hi friends,
Super work RLM, the sofware is complete.
Technically, displaying and analyzer while playing from our program is strait forward because we have a data and pose no problem other than intelligent coding for speed. I send, also, a routine to Matvey which takes 32 pnt fft and returns 16 point normalized result for drawing together with and example program(for those new to FFT: the fft of a REAL sequence of symetric,i.e. when there are 32 samples in time domain, the magnitude in frequency domain is symmetric wrt origin and phase is anti-symetric). However, the thing I am in trouble is in playing the AUDIO CDs. Basicly you tell system to play the audio and it plays. As far as I know the data is transparent to the computer and handled by the sound card. In fact, if we think the hardware there is an Audio out line from CD player to the sound card and sound card just amplifies the incoming signal to the speakers. So, in such a case we can not get the digital data.
- The question is how one can handle this?
- I can only propose that, we may read the digital data from the CD(as if we are copying a CD) convert it to a WAV or another directly playable chunk format and play it, which may be tedious.
Do you have a solution?(since this is a knowhow you may not explain it)
Regards, (Matvey, you may ask anything that you found problematic in Fourier Transform)
Igor
0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
No no Igor, both SuperSonic, and SpectraRTA, that RLM and rmarotta sugested, are showing a spectrum analizer for everything, including WAV, Audio CD, MIDI, and anything else!

RTA, Igor, read some comments above...
0
 

Author Comment

by:MB122897
Comment Utility
Answer accepted?? There's a bug in experts-exchange!!!
I haven't visited this place for some weeks!

Nothing personal, rmarotta :)

Maybe someone did that instead of me?
0
 
LVL 9

Expert Comment

by:rmarotta
Comment Utility
There has been no activity for weeks.  The computer auto-grades the question after a period of inactivity, (3 weeks has elapsed since the last post).
I thought it had been abandoned.
Ralph

0
 

Author Comment

by:MB122897
Comment Utility
It's supose to delete the question though, nit to grade it.

Again, nothing personal, but it's just that Inter is very close to completing this (we converse via email), and the current answere from you is helpfull, but it's not what I really need...

PS my pointes were deleted too - about 600 :)
0
 
LVL 9

Expert Comment

by:rmarotta
Comment Utility
MB,
There were only 250 points assigned to this question.  Perhaps you had other questions open as well?
A question will not be deleted if there is an answer proposed.
You are encouraged by E-E not to use private e-mail so that everyone connected with the thread will be able to follow it.
Information about grading is here:
http://www.experts-exchange.com/info/grading.htm
Regards,
Ralph

0
 

Author Comment

by:MB122897
Comment Utility
Well, nevermind. I can handle the points... Just shame that this paused conversation is canceled. Anyway, when I find what I really need, I'll post it here so everybody can get it...

I sugest you post emails so I send you pieces I will have

Big thanks to all of you!

Kind regards
bosism@netvision.net.il
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now