connect to sound card
1. How do I connect to a sound card?
2. After connecting I wanting to send signals there how do I do that?
3. What is the format of the signals that I send have to be in?
I know I can use windows api's to acheive all of this more easily, but I want to see if it is possible to take a sound such as a person saying "a" and making it say anything by changing the frequency adding and changing things.
Thanx in advance!
Here is perhaps worth a read through
1. & 2. You almost have to use the Windows API/Drivers. This does not mean that you have to write a full-GUI program. The sound card manufacturers don't usually seem to publish the specs necessary to communicate directly with their cards. The manufacturer writes a driver that interfaces with the OS/API in a standard way.
Also, the newer versions of Windows won't allow you to access a hardware address in "user mode". (You can access the hardware with Win98.) You have to use a kernel mode driver. Writing a kernel mode driver is not trivial.
3. There are 3 ways to get sounds. The 1st way is to send a stream of "samples" that form the "wave". This is how .wav and .mp3 files are played.
The 2nd way is with MIDI. MIDI is generally for simulating musical instruments. With MIDI, you basically send some set-up information (i.e. to make a guitar sound) and then send the notes. Games usually use lots of MIDI because it doesn't require much CPU processing power, or bus-bandwidth. You just send the "musical notes" and the sound board does the processing. I think MIDI is what you want to use.
The 3rd way is to send analog sound directly to the sound card. This is what happens when you play a music CD in you computer. The CD drive has it's own Digital-To-Analog converter, and the sound goes directly to the sound card via an analog cable. This puts no load on your CPU or data bus.
Try searching microsoft.com for "Text-To-Speech". I believe you can download their TTS engine and some sample code. TTS seems to be included with WinXP.
While I was researching I came across a function called _outp and _inp. _outp will connect to a port and send a byte to that port. Will I be able to use _outp to send signals to the sound card or there is another way? If I use _outp depending on what slot the sound card is in the mother board will set the value of the port adress to use. How can I search for a sound card? I know this is possible because no matter where I plug in my video card to the motherboard somehow it finds the video card and uses it to display.
Thanx in advance!
Don't try this at home !
The sound card has a range of hardware addresses assigned to it via the "plug and play" process. (Older ISA-slot cards used to have their address set by DIP switches.) So, it doesn't matter which slot it's in.
You can find-out the address thru the control panel:
Start/Settings-> Control Panel-> System/Device Manager-> Sound Video & Game Controllers)-> (Your Sound Card)-> Properties-> Resources. Of course, if you know what you're doing, your program can get this info from the registry. (And no, I don't know what I'm doing. :)
So, you can read and write bytes or words to and from the sound card. But, the real problem is to find-out the protocol / format of the data. Maybe you can get some specs from the soundcard manufacturer. Maybe the manufacturer uses an industry standard or psudo-standard. Like I tried to say above, normally, the standardized protocol interface is between the driver and the API. The sound card manufacturer does not have to disclose how to communicate with the hardware. They only have to disclose how to communicate with the driver. Or just supply a driver that communicates with the OS in a way specified by the OS manufacturer.
The only good news is that many Linux drivers are written by 3rd parties. These people need the info you are looking for, so it is available for some cards. And, many cards are "Soundblaster compatable" or "Roland compatable", and these may have common interface, and the specs may be available somewhere.
Use the manufacturer's driver and the OS API! Reading and writing bytes to and from the sound card is essentailly writing your own driver, and this is freeking difficult! Don't try this at home!
Also: _outp and _inp are system-specific. The are not portable-standard C++. They will generate an "access violation" error on WinXP.