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 2013年09月29日 19:24 by serhiy.storchaka, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| aifc_sampwidth.patch | serhiy.storchaka, 2013年09月29日 19:24 | review | ||
| pluck-ulaw.aifc | serhiy.storchaka, 2013年09月29日 19:24 | Sample u-law compressed file | ||
| Messages (2) | |||
|---|---|---|---|
| msg198631 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年09月29日 19:24 | |
In u-law and A-law compressed AIFC files the sampleSize field is equal to 8 (bits). The aifc module transparently compress/uncompress audio data to 16-bit, but doesn't support the samplewidth parameter in consistency. This causes two bugs:
1. On read getsampwidth() returns 1, but should return 2 (bytes per sample in uncompressed audio data). readframes() returns twice less data than expected.
>>> import aifc
>>> f = aifc.open('pluck-ulaw.aifc', 'r')
>>> f.getparams()
_aifc_params(nchannels=2, sampwidth=1, framerate=11025, nframes=3307, comptype=b'ulaw', compname=b'')
>>> f.readframes(1)
b',\x02'
f.readframes(1) should return 4 bytes (2 channels, 16-bit uncompressed data).
2. On write wrong value 2 is saved in the sampleSize field. Resulting file is invalid and can't be read in other programs.
Here is a patch and sample file. For tests see issue18919.
I'm sure G722 support is broken too, but I have no any testing files.
|
|||
| msg199576 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年10月12日 15:25 | |
New changeset 567241d794bd by Serhiy Storchaka in branch '2.7': Issue #19131: The aifc module now correctly reads and writes sampwidth of http://hg.python.org/cpython/rev/567241d794bd New changeset 863a92cc9e03 by Serhiy Storchaka in branch '3.3': Issue #19131: The aifc module now correctly reads and writes sampwidth of http://hg.python.org/cpython/rev/863a92cc9e03 New changeset cff4dd674efe by Serhiy Storchaka in branch 'default': Issue #19131: The aifc module now correctly reads and writes sampwidth of http://hg.python.org/cpython/rev/cff4dd674efe |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:51 | admin | set | github: 63330 |
| 2013年10月12日 18:23:03 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2013年10月12日 15:25:57 | python-dev | set | nosy:
+ python-dev messages: + msg199576 |
| 2013年10月12日 12:55:01 | serhiy.storchaka | set | assignee: serhiy.storchaka |
| 2013年09月29日 19:31:40 | serhiy.storchaka | link | issue18919 dependencies |
| 2013年09月29日 19:24:56 | serhiy.storchaka | set | files: + pluck-ulaw.aifc |
| 2013年09月29日 19:24:02 | serhiy.storchaka | create | |