Sound test tone generator code#
WAV allows stereo sound too, but this code sample only uses non-stereo sound. This method takes sound samples which are calculated and then plays those, so you need to code what each audio sample needs to be at the given moment in time. So you can create 2 sine waves or many, many more, or triangle waves, or even speech synthesis with this method if you want.
The process i use in this code allows one to build any audio you want, and plays it. And maybe it is almost exactly what you are asking. But maybe you can run with this and get it to work for what you need. Maybe you need something more detailed and maybe this doesn't work for you. Thus the volume control on the speakers affects what decibel your sounds will produce, and sending a certain decibel to the sound card thus makes no sense to me.
My understanding is that decibels are simply a measure of how loud a sound is, thus after it's been reproduced by the speakers. For instance i fail to understand how audio as measured in decibels is sent to the sound card. Regarding the decibels and sending it to the sound card, i don't really understand what specifics you are referring to. Here is a function i coded that plays a simple frequency for a certain duration. Using the you can play a sound from a memory stream that you build (in WAV format). David, playing audio to the speakers was built right into.