New submission from Serhiy Storchaka: 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. ---------- components: Library (Lib) files: aifc_sampwidth.patch keywords: patch messages: 198631 nosy: r.david.murray, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Broken support of compressed AIFC files type: behavior versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file31909/aifc_sampwidth.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19131> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com