Hello everybody :)

I really need your help. The problem is how to get frequency of left and right audio channel?

Possible situation: some program plays some sound and my app have to get frequency of left and right audio channel. App have to react on every sound playing ...

I can not find a solution. I tried to get access to sound card driver but it seems to hard for me to code it :(.

I'll very happy :) if you can help me.


--
May the force be with you ...
Posted on 2003-03-31 05:20:01 by gaidar
Afternoon, gaidar.

Maybe if you gave us an idea of what you wish to accomplish, we might be able to come up with a solution.

Why do you want your proggy to react to what's coming out of the speakers?

Cheers,
Scronty
Posted on 2003-03-31 06:10:29 by Scronty
I do apologize for misunderstanding. This is my fault.

I need a code to get frequency of every playing sound to show indicator like volume control for left and right channels (for stereo, of course).

Something like WinApm's equal.
Posted on 2003-03-31 06:29:23 by gaidar
gaidar :)
I see you're a VB coder. VB has implemented DirectX (DirectSound)

I have exactly what you seek.
http://www.fullspectrum.com/deeth/
search for the source code of DeethSASource
(Deeth Spectrum Analyser)
all you need to customize it is to write around 60 lines of code.
Have fun ;)

Why have you chosen this nickname "gaidar" (in Russian and Bulgarian "bagpiper") :) ? I'm curious.
Posted on 2003-03-31 12:09:52 by Ultrano

Originally posted by Ultrano
gaidar :)
I see you're a VB coder. VB has implemented DirectX (DirectSound)


Yes, I am a VB coder, but not only VB :). Of course I know about the DirectSound :)


I have exactly what you seek.
http://www.fullspectrum.com/deeth/
search for the source code of DeethSASource
(Deeth Spectrum Analyser)
all you need to customize it is to write around 60 lines of code.
Have fun ;)


Thank you. I'll download it.


Why have you chosen this nickname "gaidar" (in Russian and Bulgarian "bagpiper") :) ? I'm curious.



Gaidar is my real name :)

What that mean 'bagpiper'? I've never heard about this.
Posted on 2003-04-01 03:19:22 by gaidar
>Gaidar is my real name
What that mean 'bagpiper'? I've never heard about this


well, then it's only in Bulgarian. A bagpiper (gaidar) is a person who plays music with a bag-like instrument. Highlanders and Bulgarians have bagpipers in their/our traditions. The Scottish ones dress up in dresses, though.

I find all this very entertaining. I have a teacher, whose name literally means "Locked up peacock" . My family name means ... :) ........ "made out of watermelon" :grin: , so if someone calls me loggerhead, he won't be far from truth :). (self-ironizing does not hurt).

<edit>: I have a friend, whose first name means "Leader technology" .. :)
Posted on 2003-04-01 07:25:21 by Ultrano
btw, this is my 101st post here.
to visualize the last post:
:grin:
Posted on 2003-04-01 07:38:09 by Ultrano
Thanks for info about my name.

But that is not exact solution. Could you help me to change it to get output stream, if it is so easy, please?
Posted on 2003-04-01 10:29:25 by gaidar
No problem. It was in fact 20 lines of code :)

See the attachment and source code. The place I modified is where you will see my sign and a lot of comment. I made the program start automatically to record, choosing the best record source.

You can setup frequency and sensitivity easily, which is in fact all you need.
I setup the program to display a messagebox when your sound appears.

If you do not know exactly which sound frequency you need (to setup the Frequency1 variable), do this:
1) run this program, and make sure you see its form1
2) run the sound you want to be detected
the spectrum analyser will show the sound spectrum
make a snapshot quickly with PrintScreen SysRq
view the snapshot with MS Paint (you may now turn off the sound and the program)
find the tallest line on the picturebox of the form - this is the strongest frequency component of the wave. Count how many pixels from the picturebox from the left to the right there are. The first line is 0, the second 1, the third 2 and so on. The maximum number you will get is 203
If you have trouble with finding the frequency with the snapshot, send the snapshot here, at this thread, I will tell you the value
so, then setup Frequency1 with that value. Important: if you have value 12, then do:
Frequency1=12 * 2
and never this: Frequency1=12 * (1024 / 11025)

your app should be running well.

I made many tests here, it works perfectly
ask if you have questions, I'm here to answer :)
Posted on 2003-04-01 13:37:10 by Ultrano
oops, forgot the file itself :)
Posted on 2003-04-01 13:39:54 by Ultrano
Thank you very very much!



ask if you have questions, I'm here to answer :)


OK. I will if I have some :).

Thanks once more :)

This app get microphone well, but don't get sounds playing by WinAmp. Am I wrong?

I'll test it ... but can't see any action ...

Sorry if I so stupid.
Posted on 2003-04-03 08:40:32 by gaidar
The snapshot :(
Posted on 2003-04-03 08:49:30 by gaidar
The sound played with WinAmp.
Posted on 2003-04-03 08:51:47 by gaidar
>This app get microphone well

no, no ! The app must never get the microphone. I forgot to tell that you have to setup the capture line of your soundcard :). ControlPanel->Multimedia->Audio-> "Recording" frame -> the button with an image of a microphone and mixer, left to the combo box. You'll see your mixer's recording props. Below the faders you will see checkboxes. Find the fader, titled "Loopback" or "Stereo Out", or anything that reminds of "Soundcard's output, looped to the input". Setup the fader to maximum, too. If you get your PC rebooted in a Ctl-Alt-Del or harder, you will lose that settings (just a precaution).
Posted on 2003-04-03 19:33:24 by Ultrano
I've got the idea. And I understood the sample. Thanks. I've made it more useful for me (I'm no so bad as I thought :)).

But another question: How can I change the audio settings from my app? I don't want to do it myself every time than I want to use Spectrum Analyzer. Is it possible?
Posted on 2003-04-04 08:26:29 by gaidar
That's a question I partly want to solve, too :( I have seen the DX SDK , and it's really no way to find which damn fader and checkbox is the unique loopback.
Different soundcards call their loopbacks differently. My previous sndcard had "Loop Audio", this one has "Stereo output". But if you know your sndcard's loopback fader name, you will be able to create some function that enables the loopback. See DX's "MixApp" example.
Posted on 2003-04-04 11:41:54 by Ultrano
That sample is easy :) But if I need to change settings for every card it's really hard. I've tried a lot of methods to solve the problem. But ...

May be somebody can help us? :)
Posted on 2003-04-05 06:08:07 by gaidar
I think what nobody knows :(
Posted on 2003-04-16 09:41:25 by gaidar
I've already assumed that there's no way to find which is the loopback mixer. The fellows at MS did not think much of multimedia. Or maybe they decided to let the device drivers' writers to figure it out themselves, as they're experts in that. But they did not make any standard for that. :/
Posted on 2003-04-16 10:42:32 by Ultrano
I don't think so. I saw apps which did exactly that what I need to do! But it was so many years ago :).

I have one idea, but I didn't try it. If I can do somethink useful I'll do! And I'll share it with others ...
Posted on 2003-04-18 11:43:42 by gaidar