New submission from Alex Robinson <[email protected]>:
Corrected code in writeframesraw():
self._datawritten = self._datawritten + len(data) *
self._sampwidth
else:
self._file.write(data)
self._datawritten = self._datawritten + len(data) *
self._sampwidth
Note that the default (not byte swapped) assignment to _datawritten must
also be multiplied by _sampwidth. If not, audio programs will ignore the
second half of a 16-bit-sample file.
As a side note, the calls to _patchheader() do not need to be protected
by this "if" statement:
if self._datalength != self._datawritten:
_patchheader does the same test to optimize its operation.
----------
components: Library (Lib)
messages: 79586
nosy: alex_python_org
severity: normal
status: open
title: wave.py writes 16 bit sample files of half the correct duration
type: behavior
versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue4913>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com