Jump to content
  • Advertisement
Sign in to follow this  
blueshogun96

How are audio channels arranged in a .wav file?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay, I'm given the task to write a tool that gets the volume level of each audio channel within a .wav file with 4 channels.  I don't know how the data is arranged (i.e. how the channels are aranged byte wise), but I do know how to read a .wav file from scratch.  Let's say samples are 16-bit, do I ready every fourth word to get the data per channel?

 

And if you're thinking of saying "use .ogg instead", just know that I can't because the tool that we are using here for my automation testing generates .wav files, and I have to build my autmation around this and more, so I won't bother with that.

 

Thanks,

 

Shogun.

Share this post


Link to post
Share on other sites
Advertisement

What library would you recommend fastcall?  I understand how RIFF works, it's just the audio channel stuff I don't understand.  When I reach the data chunk, how do you separate each audio channel from the data?

 

Shogun.

Share this post


Link to post
Share on other sites

Thanks fastcall, but not quite.  The mmio API doesn't appear to let me select one channel to read from.  I'm not going to be playing back any of these audio samples either.  I'm just going to be reading the sound samples to average out the sound levels from each.

 

Shogun.

Share this post


Link to post
Share on other sites

For PCM (almost all wav files), audio data is stored as an array of interleaved channels of whatever the sample size is (8, 16, 24 common, 32, 64, 32fp, 64fp possible). Integer values are signed little-endian.

 

e.g.

sample1L sample1R sample2L sample2R sample3L sample3R...

Share this post


Link to post
Share on other sites

For PCM (almost all wav files), audio data is stored as an array of interleaved channels of whatever the sample size is (8, 16, 24 common, 32, 64, 32fp, 64fp possible). Integer values are signed little-endian.

 

e.g.

sample1L sample1R sample2L sample2R sample3L sample3R...

Okay, I had a feeling that was it.  If that's the case, then I can write this tool easily and quickly.  Thanks.

 

Shogun.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!