Link to home
Start Free TrialLog in
Avatar of MB122897
MB122897

asked on

Spectrum Analizer-up to 500 pts.!!!

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)
Avatar of smeebud
smeebud

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
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.
Avatar of MB122897

ASKER

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...)
I suggest you post a detailed question to
comp.os.ms-windows.programmer.win32

Bud
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!
easy? I'm quite sure it's not... :-)

Please tell me what is fourier transform?
Smeebud, what is the address?

comp.os.ms-windows.programmer.win32

I can't enter there...
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

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.
                                                       
There is one of those that comes  with the Creative Labs Sound Blaster 64 GOLD.
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.

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).
Try the following web site for C++ code for fourier transforms.

http://cfatab.harvard.edu/nr/bookcpdf.html
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
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
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...
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, .....
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
ASKER CERTIFIED SOLUTION
Avatar of rmarotta
rmarotta

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm author of SuperSonic, http://www.gosupersonic.com

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

-Rob
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
 
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...
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 
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.
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?
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

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.
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
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...
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?
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

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 :)
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:
https://www.experts-exchange.com/info/grading.htm
Regards,
Ralph

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