Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
Create a capture buffer in DirectSound which is part of the DirectX SDK. It will allow you to set the sampling rate (I believe some cards are hard-wired to a few frequencies while others allow any rate but I'm not too sure, I've always used the standard 44 KHz rate). I believe it also lets you sample in stereo or mono. You can also pump the data into an output buffer and create an FX chain on that output, that's where it gets real fun. I used it to rewrite a college lab that did digital filtering with an ISA card that sampled at 15 KHz, in an old DOX Box that ran at 8 MHz. It was on it's last legs so I did the capture in DirectSound. The students then had to write the filter function to transform the raw samples into filtered samples and the filtered samples were sent to the output buffer to be measured on the scope. The instructor loved me for that one.
To get on with it, I believe there is the equivalent of some kind of sound input device in the OpenGL SDK but you would have to check it out. CreativeLabs has an OpenAL SDK that allows for the creation of capture buffers but I've never used it. Java also has (I think) some kind of sound class that allows the capture of sound input. But all in all, I think you are best off to do it with DirectSound in VB or VC++.
Of course, if someone has the specs on the Soundblaster registers and knows how to read the sampling rate directly that might be the best way to go. The only ones I remember were for the SB16 board by Brodsky and I don't know if they apply to the new boards. Try this link for doing it directly in the SB registers:
I've used WaveLib to capture audio from the line input. You can search for it and find many examples. The advantage is there is nothing to install - it gets compiled into your code.
If you decide to use the raw register interface to your sound card, your application will not be portable. That means it will only work with one sound card.
If you elect to use an sdk like DirectSound or WaveLib, it will be portable and work with any sound card since each sound card will have it's own driver installed and provide a generic interface.
When testing, make sure you setup the Audio Mixer correctly (most default settings will turn off line input in favor of mic input) or you won't get any audio even if your code is working.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.