[issue8311] wave module sets data subchunk size incorrectly when writing wav file

Jeff Pursell report at bugs.python.org
Sun Apr 4 19:57:12 CEST 2010


Jeff Pursell <jpursell at gmail.com> added the comment:

Here's my fix.  The left file is the original and the right file is my version.  Perhaps someone should check this patch on a big endian machine to make sure there are no issues there.  I do not anticipate any issues.

416c416
<         nframes = len(data) // (self._sampwidth * self._nchannels)
---
>         nframes = len(data) // self._nchannels
427c427
<             self._datawritten = self._datawritten + len(data)
---
>             self._datawritten = self._datawritten + len(data) * self._sampwidth
463c463
<             self._nframes = initlength / (self._nchannels * self._sampwidth)
---
>             self._nframes = initlength // self._nchannels

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8311>
_______________________________________


More information about the Python-bugs-list mailing list