1. RE: Q about WAV format
- Posted by Al Getz <Xaxo at aol.com> Apr 18, 2001
- 373 views
jstory at freenet.edmonton.ab.ca wrote: > I found a website that describes WAV files. It tells me everything > except one little detail that I need to know. The first 43 bytes I can > ignore except for bytes 10-11 which tell me whether it is mono or > stereo. > What I'm interested in is the bytes from 44 to the end. Each byte is > from > 00 to FF; 00 is negative voltage, FF positive voltage. My question is: > in > the case of stereo, where is the data for one ear and the data for the > other ear? Am I correct in guessing that bytes 44,46,48, etc are for > one > ear, and bytes 45,47,49, etc. are for the other ear? > This has nothing to do with Euphoria except that I was considering > making a program in Euphoria that would modify WAV files. > > Jerry Story > > > Hello there, I'm pretty sure the bytes alternate, L,R,L,R, etc. One way to test this is to simply make a stereo wave file with both channels recording from the same mic. Save the file and look at the bytes with a hex editor. Have fun with it. --Al
2. RE: Q about WAV format
- Posted by Al Getz <Xaxo at aol.com> Apr 18, 2001
- 372 views
Al Getz wrote: > > jstory at freenet.edmonton.ab.ca wrote: > > I found a website that describes WAV files. It tells me everything > > except one little detail that I need to know. The first 43 bytes I can > > ignore except for bytes 10-11 which tell me whether it is mono or > > stereo. > > What I'm interested in is the bytes from 44 to the end. Each byte is > > from > > 00 to FF; 00 is negative voltage, FF positive voltage. My question is: > > in > > the case of stereo, where is the data for one ear and the data for the > > other ear? Am I correct in guessing that bytes 44,46,48, etc are for > > one > > ear, and bytes 45,47,49, etc. are for the other ear? > > This has nothing to do with Euphoria except that I was considering > > making a program in Euphoria that would modify WAV files. > > > > Jerry Story > > > > > > > Hello there, > > I'm pretty sure the bytes alternate, L,R,L,R, etc. > One way to test this is to simply make a stereo > wave file with both channels recording from the same mic. > Save the file and look at the bytes with a hex editor. > > Have fun with it. > --Al > > According to my source, the bytes are interleaved L,R,L,R (in uncompressed PCM format) as i had stated in my last post, but that exact byte sequence is for 8 bit samples. If you use 12 bit samples, the L,R sequence is the same, but you can expect 12 bits per sample, but 16 bits used per sample, so 32 bits per 'frame'; one frame consisting of one sample for each channel. The samples themselves are in little endian (x86) format. Here's a little chart showing the sample width and the actual bits used to store the sample: SAMPLE BITS USED(in .wav) 1 to 8 bits 8 9 to 16 bits 16 17 to 24 bits 24 25 to 32 bits 32 The relevant bits are left justified, with right side zero padding. One frame of 16 bit samples in stereo would require 32 bits total. One frame of 15 bit samples in stereo would still require 32 bits total, with the highest bit set to zero in both samples. The stereo samples are stored side by side like this so that its faster to send both channel data to the DAC in the audio card, which has to play back both channels simultaneously. Good luck with it. --Al