Instead of porting all the API code to C#, and having an 'interesting' history with VB6 (who doesn't), I hacked the VB6 code into a dll. This library now provides a list of available recording devices, listens to the microphone and raises an event when the volume is greater than a given threshold. And best of all its easily accessible from .NET code.
Internally, it
- Grabs a buffer of 8-bit samples from the soundcard. 8-bit means each sample value is 0-256, with 127 being silence.
- Loops through the buffer, and if there is a value greater than the threshold, raise an event
Get the Detector library (+ source + sample C# application)
Feel free to use it in your own projects. Enjoy!
6 comments:
Hi, I'm interested in capturing audio myself and downloaded your solution, but the Reference to Detector is broken. How do I fix that? Referencing Interop.Detector.dll or Interop.SoundDetector.dll made the program compile with error 80040154:
Retrieving the COM class factory for component with CLSID {C153004D-7066-465E-8C04-B94124A88595} failed due to the following error: 80040154.
Any clues would be nice :)
Regards,
Jonas
Hi I have the same problem as Jonas. I get "Retrieving the COM class factory for component with CLSID {C153004D-7066-465E-8C04-B94124A88595} failed due to the following error: 80040154"
Ca you help?
Kleanthis
If you're getting the COM error, it's because you only have the Interop.Detector.DLL in the bin\Debug directory, and not the actual Detector.DLL file.
I noticed the Detector.DLL did not appear to be in the package. You'll want to unzip the DetectorDLL_source.zip, open the project in Visual Basic 6 and do a File-> Make Detector.dll, then add a reference to the .NET application to this DLL and everything should work fine.
Hi Jeff,
In your Sound detector library, when I load your project, there was a reference to "Detector" that is not found. Do you know where it is?
Thanks,
N
Hi!
I have tried your application (Sound detection in c#) and I've got the same error : Retrieving the COM class factory for component with CLSID {C153004D-7066-465E-8C04-B94124A88595}.I saw that the Detector reference is missing.Can you tell how can I solve this problem?I don't know VB6. Thanks
hi i am unable to dl your files
Imran
Post a Comment