How do you get a program to generate a sine wave and play it using the sound card?
Printable View
How do you get a program to generate a sine wave and play it using the sound card?
Eh... that's not easy at all.
You have to look into libraries that interact with the sound card. DirectX has its deal but I'm sure there are more simple free ones. Sending data to computer peripherals is not a simple thing to do at all. It requires interaction with the drivers and it's generally easier to find prewritten libraries that handle that.
Ok I found a program for generating the sine waves and saving them as .WAV but i still don't know how to send a .wav to the sound card??
MMmkay, well your best bet would be Windows. :)
There are tutorials here: http://nehe.gamedev.net/
...and #21 has a function known as PlaySound(). Enjoy.
I'm trying to make a phone dialler that generates the two tones needed for each number in just in case your interested, just pick up your reciever and run the program.
Cheers for that, by the way, it works a charm
btw: opengl has nothing to do with sound, im sure that tut uses another library for that.
I believe it. Yeah it looks like PlaySound is a Windows function. Oh well. I blame communism.