SRL Archive - Discussions and Debates

Sound Recording/Processing/Detection


A G E N T

2008-11-30 15:57:18

I was thinking about that old plugin there used to be for sound detection, but after a lot of searching, I can't find any examples done in plain C. If anyone knows the appropriate headers, etc, in order to get the waveIn/open libraries from windows _without_ using .NET, it would be much appreciated :)

http://msdn.microsoft.com/en-us/library/aa446573.aspx

Freddy1990

2008-11-30 19:59:46

The only way to properly record sound from the pc itself is by writing a kernel mode driver which is placed in between the sound api and the sound card when intercepts any sound sent to the graphics card. Shocker's plugin relied on a feedback function in the soundcard which has a similar effect, however, it's very inefficient, not all cards support it and it's just not accurate… But writing a kernel mode driver isn't exactly easy…

A G E N T

2008-11-30 20:30:48

From: Freddy1990
But writing a kernel mode driver isn't exactly easy…


Yes, I'm not that interested in making the plugin. :)

Smartzkid

2008-12-01 01:07:41

AFAIK DirectSoundCaptureCreate8 or waveInOpen will both allow you to capture from the 'stereo mix' in XP, no?

http://msdn.microsoft.com/en-us/library/bb219691(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms713735(VS.85).aspx
http://www.programmersheaven.com/mb/Win32API/299454/299454/recording-formats-waveinopen/?S=B20000

Wizzup?

2008-12-01 02:29:58

Maybe try the cross platform http://www.portaudio.com/
And here's the package for Free Pascal: http://www.microbizz.nl/portaudio-20070924.tar.bz2
http://www.google.co.uk/search?hl=en&q=portaudio+freepascal

A G E N T

2008-12-01 09:50:18

Thanks, Wizzup?, those links look promising. I think I will build it in C and FPC, because I'm not sure which goes better into SCAR as a plugin.

EDIT: The included sample binaries work very nicely to get recorded sounds into buffers & files.

Widget

2008-12-02 02:14:57

How would you go about analyzing it though? The sounds won't match exactly.

You could try looking through Audacity's source for it's frequency analyzer:

Otherwise, you could try generating a bitmap based on the peak amplitudes of the sounds and compare them to pre-made bitmaps with some distortion :)

A G E N T

2008-12-02 16:51:36

The portaudio package that Wizzup? linked to also detects average amplitude, volume, etc - should be able to compare through that.

Freddy1990

2008-12-02 17:29:00

From: Smartzkid
AFAIK DirectSoundCaptureCreate8 or waveInOpen will both allow you to capture from the 'stereo mix' in XP, no?

http://msdn.microsoft.com/en-us/library/bb219691(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms713735(VS.85).aspx
http://www.programmersheaven.com/mb/Win32API/299454/299454/recording-formats-waveinopen/?S=B20000


Stereo Mix is the feedback loop in the soundcard, it's also not always called Stereo Mix, afaik there's no way to record outgoing sound properly in every case without a kernel mode driver…

Smartzkid

2008-12-02 21:48:39

Hmm.. we could enumerate sound devices and have the user pick one, haha it'd be pretty funny to see all the leechers try to use it..

Freddy1990

2008-12-03 06:55:57

From: Smartzkid
Hmm.. we could enumerate sound devices and have the user pick one, haha it'd be pretty funny to see all the leechers try to use it..


That's not that hard, but there's still the issue that not all sound cards support an outgoing audio feedback loop… Which is why I haven't been able to create a working sound detection model yet

Widget

2008-12-03 18:24:58

I'm sure you're talking about this?

I have yet to see a sound card that can't do that.

Smartzkid

2008-12-03 21:43:09

Maybe those really cheap crappy ones?

Afaik my integrated realtek hd doesn't have it. But I burned that out a while ago, discrete sound card is far nicer :)

Freddy1990

2008-12-04 12:43:09

My integrated realtek hd doesn't have it either

R0b0t1

2008-12-09 22:10:54

You don't be stupid, that is what you do. You could do it if you really wanted and didn't procrastinate. Just start googling.

Freddy1990

2008-12-10 07:20:57

From: R0b0t1
You don't be stupid, that is what you do. You could do it if you really wanted and didn't procrastinate. Just start googling.


I probably could, but it's a very time expensive project and there's little information to be found about the subject because the technique of capturing sound this way is most commonly used in payed software which means that there's little people actually releasing any information about it, it'd take a while for me to figure out how to do it. And also, kernel mode drivers are most commonly coded in c++, not that I can't code c++, it just slows me down a bit as I'm not used to it… Delphi kernel mode drivers do exist, but well, you can imagine to what extend…