We can expand on the waveform synthesis and give it the ability to produce any of the four types of waves possible, and any sort of combination of them we desire. This works extremely well for most sound effects and as an aid to audio troubleshooting and system development.
Now for a few notes about programming this type of thing. First of all, I will try to help you avoid some of the things that tripped me up along the way. There are two different systems at work in trigonometry in PCs. It is important that you understand the difference because you will not get far until you sort that one out. ANSI C uses angles expressed in radians. BASIC is a little more inconsistent, but DarkBASIC Professional uses degrees. The first programming tool you need is the ability to move in both directions:
The audio in Windows is handled by the Windows MultiMediaAPI directly. DirectX does not add much functionality to what is already present. The legacy system is just fine. DBPro does offer some assistance in loading and playing wave files, but if you want to start working in real time, you will need to use the Windows API functions to access the sound card's buffers directly. Saving wave files is not in the DBPro command set as such, but saving them is not particularly mysterious. Wave files use a format called RIFF, or Resource Interchange File Format. In a RIFF file, there are chunks. These chunks have identifiers. Wave files only use two types of chunks, and so dealing with them is pretty straightforward. The very first thing in a RIFF file is the word RIFF, or more precisely, the byte sequence 82 73 70 70. Next is the length of the entire file, expressed as an unsigned long, DWORD, or whatever gets you a 32-bit variable. That is followed by the text "WAVEfmt ", or 87 65 86 69 102 109 116 32. Next is the WAVEFORMATEX structure, which I will show you shortly. The next bit is another chunk ID, this time its name is "data", or 100 97 120 97. Finally, there is the length of the wave data in bytes, which again is a 32-bit value. That is followed by the samples, which are interleaved by channel. We will restrict ourselves to one and two channels, which are MONO and STEREO. In a STEREO wave file the left channel is followed by the right channel in the data stream, making stereo file handling a breeze.