This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2010年04月04日 13:36 by Jeff.Pursell, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| testTone.zip | Jeff.Pursell, 2010年04月04日 13:36 | zip file containing 2 .py files to demonstrate bug | ||
| wave_test_write_array.patch | serhiy.storchaka, 2013年09月04日 13:48 | review | ||
| audio_write_nonbytes.patch | serhiy.storchaka, 2013年10月14日 11:43 | review | ||
| audio_write_nonbytes_2.patch | serhiy.storchaka, 2013年11月10日 19:49 | review | ||
| Messages (9) | |||
|---|---|---|---|
| msg102342 - (view) | Author: Jeff Pursell (Jeff.Pursell) | Date: 2010年04月04日 13:36 | |
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. |
|||
| msg102346 - (view) | Author: Jeff Pursell (Jeff.Pursell) | Date: 2010年04月04日 17:57 | |
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 |
|||
| msg102349 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2010年04月04日 20:31 | |
Any chance you could create a unit test for this? (The current set of tests is...pretty minimal.) Also, having the patch in unified diff format relative to the top of the source three would be helpful (although this one is small enough we could certainly apply it by hand, having a unified diff makes it more likely someone will test it). |
|||
| msg196915 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年09月04日 13:48 | |
It's because you write an array of integers while writeframes() expects a bytes object. Here is a test. |
|||
| msg199871 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年10月14日 11:43 | |
Here is a patch for all three audio modules. After dropping support of string (which is meanless) in the audioop module (issue16685) it can be simplified. I doubt that this should be applied in maintenance releases. Support of non-bytes arguments in writerawframes() is a new feature. |
|||
| msg202561 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年11月10日 19:49 | |
Here is simplified patch. Added versionchanged tags in the documentation. |
|||
| msg203032 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年11月16日 12:07 | |
Committed in changeset b96f4ee1b08b. |
|||
| msg203033 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年11月16日 12:09 | |
New changeset 932db179585d by Serhiy Storchaka in branch 'default': Fixed issue number for issue #8311. http://hg.python.org/cpython/rev/932db179585d |
|||
| msg212939 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2014年03月08日 17:54 | |
New changeset b72615222c98 by R David Murray in branch 'default': whatsnew: sunau/aifc/wave writeframes[raw] accept any bytes-like (#8311) http://hg.python.org/cpython/rev/b72615222c98 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:59 | admin | set | github: 52558 |
| 2015年02月10日 11:48:21 | serhiy.storchaka | link | issue1423 superseder |
| 2014年03月08日 17:54:17 | python-dev | set | messages: + msg212939 |
| 2013年11月16日 12:09:22 | python-dev | set | nosy:
+ python-dev messages: + msg203033 |
| 2013年11月16日 12:07:43 | serhiy.storchaka | set | messages: + msg203032 |
| 2013年11月16日 12:06:03 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2013年11月10日 19:49:48 | serhiy.storchaka | set | files:
+ audio_write_nonbytes_2.patch messages: + msg202561 |
| 2013年10月14日 11:43:26 | serhiy.storchaka | set | files:
+ audio_write_nonbytes.patch versions: - Python 2.7, Python 3.3 messages: + msg199871 assignee: serhiy.storchaka type: behavior -> enhancement stage: needs patch -> patch review |
| 2013年09月04日 13:48:28 | serhiy.storchaka | set | files:
+ wave_test_write_array.patch versions: + Python 2.7, Python 3.3, Python 3.4, - Python 2.6 messages: + msg196915 keywords: + patch stage: test needed -> needs patch |
| 2013年09月03日 20:47:49 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka |
| 2010年04月04日 20:31:04 | r.david.murray | set | priority: normal nosy: + r.david.murray messages: + msg102349 components: + Library (Lib), - Extension Modules stage: test needed |
| 2010年04月04日 17:57:10 | Jeff.Pursell | set | messages: + msg102346 |
| 2010年04月04日 13:36:51 | Jeff.Pursell | create | |