Search code examples
pythonaudiowave

How do wave files store multiple channels?


I've created two wave files using Audacity. Both have 44100hz sample rate, 32-bit float samples, were saved as WAV (Microsoft) 16-bit signed and contain 1s of silence (according to Audacity). The difference is that one file contains one channel, while the other have two (stereo). When reading the one channel file I got frames like this:

0x00 0x00  
...  ...  

Just as expected, but when reading the second file I got:

0x00 0x00 0x00 0x00  
0x01 0x00 0xff 0xff  
0x00 0x00 0x00 0x00  
0x00 0x00 0x01 0x00  
0xff 0xff 0x01 0x00  
0xfe 0xff 0x03 0x00  

This seems to be a random pattern to me. It has something to do with the way channels are stored within the wave file? Shouldn't it be something like:

0x00 0x00 0x00 0x00  
...  ...  ...  ...  

?

PS: I have used python builtin module 'wave' to read the files.


Solution

  • The very low level signal where silence was expected, may have been caused by dither used in the conversion from 32-bit to 16-bit.