wav format basics...

Started by
3 comments, last by Premandrake 19 years, 6 months ago
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?
Advertisement
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

throw table_exception("(? ???)? ? ???");

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?
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.

This topic is closed to new replies.

Advertisement