Hello Python World! I've been playing with the 'wave' and 'audioop' modules in the library, and I have a question. When I tried to read a "wav" file with samples in 32-bit float, I got the following error:
Traceback (most recent call last): File "Play.py", line 111, in ? playWAV(sys.argv[1]) File "Play.py", line 69, in playWAV f = wave.open(fname,'rb') File "D:\Python23\lib\wave.py", line 483, in open return Wave_read(f) File "D:\Python23\lib\wave.py", line 162, in __init__ self.initfp(f) File "D:\Python23\lib\wave.py", line 143, in initfp self._read_fmt_chunk(chunk) File "D:\Python23\lib\wave.py", line 264, in _read_fmt_chunk raise Error, 'unknown format: ' + `wFormatTag` wave.Error: unknown format: 3 Although the documentation doesn't explicitly say so, it appears that only 16-bit format is supported. I looked at the source code ('wave.py'), and I think my hunch is correct. On lines 245 (in method 'readframes') and 412 (in method 'writeframesraw'), a call is made to the array method 'byteswap' if the machine is "big- endian", without testing to see if the samples are 16-bit or 32-bit. I don't understand how this could work without knowing how many bytes to "swap", (ie, 2 or 4). Has anyone on this list used these modules? Am I missing something? BTW, I'm on version 2.3.2 for Windows. The 32-bit sound file was created with a program called "Audacity". I believe the format of the file is a valid wave file format, I'm able to play it with Windows Media Player. Thanks for your help. -------------------------------------------------------------------- mail2web - Check your email from the web at http://mail2web.com/ . -- http://mail.python.org/mailman/listinfo/python-list