[New-bugs-announce] [issue8311] wave module sets data subchunk size incorrectly when writing wav file

Jeff Pursell report at bugs.python.org
Sun Apr 4 15:36:53 CEST 2010


New submission from Jeff Pursell <jpursell at gmail.com>:

I tried to create a 4 second file and only heard the first 2 seconds.  The file size was correct for a 44.1 kHz, 16 bit mono file at 4 seconds, but both aplay and audactiy ignored the second half of the file.  I went to this page https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ and opened the output with a hex editor in little endian mode.  I found that at offset 40, the data chunk size was wrong.  It looked like it was just set to the number of samples.  It should be the number of samples times bytes-per-sample (2) times number-of-channels (1 in my case).  I manually set the number from 176400 to 352800 and that solved the problem for that wav file.

I'm guessing this was just an oversight and the fix will be simple.

I'll attach the code I used to generate the test tone.  Just run python -i testTone.py and it will generate out.wav with the incorrect field.

I am using pything 2.6.4 in ubuntu.

----------
components: Extension Modules
files: testTone.zip
messages: 102342
nosy: Jeff.Pursell
severity: normal
status: open
title: wave module sets data subchunk size incorrectly when writing wav file
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file16757/testTone.zip

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


More information about the New-bugs-announce mailing list