# wav format basics...

This topic is 5452 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Please help... I am in dispair from all the gibberish that makes up the wav format... Is there anyone that knows and would share the basics of wav? Just enough so i can stream a dynamically created piece of wav into a DirectSound buffer and play it?

##### Share on other sites
i would imagine that the native format for DirectSound is a wav file. you shouldn't need to decipher anything. just point the sound buffer to the wav or copy the wav to the buffer, right? have you tried reading the docs for DirectSound?

-me

www.wotsit.org

##### Share on other sites
well, ok...

I want to mathmatically generate a sound so...

1 more question... are samples the specific position of the speaker? like high numbers would mean the speaker is out and low numbers mean the speaker is in?

##### Share on other sites
Mathematically generating sound requires a decent understanding of DSP (Digital Signal Processing). There are tons of good resources and tutorials out there, for a starting point see musicdsp.org.

But for a quick answer to your question, the numbers in the sound buffer represent the amplitude (the height) of the sound waveform at the time point. The way that this is converted into the speaker moving is actually non-trivial, but it is not a 1 to 1 mapping.

For example, to generate a simple pure tone, you use the sin() function and place sin(x), sin(x+offset), sin(x+offset*2), sin(x+offset*3), etc. Offset would be some value appropriate to the output frequency (that 44,100 Hz you see in sound programs, etc.) to generate the tone.

I'm currently building a little synthesizer in my blog and there is some very basic sound tutorials there as well.

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 15
• 22
• 17
• 46