jtidman added the comment:
Yep, your solution is better. I can provide some text files (lists of numbers)
and two programs, wave2text.py and text2wav.py. These are the programs I wrote
that found this issue in the first place. Add a few checks and you could run
text2wave.py and then
New submission from jtidman :
wave.py does not always honor the sampwidth setting, especially on little
endian machines. If sampwidth is not one and big_endian is not set, then
datawritten will not be muliplied by sampwidth, causing the header to be
incorrect, and the file to appear to