Message198631
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. |
|
Date |
User |
Action |
Args |
2013-09-29 19:24:02 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, r.david.murray |
2013-09-29 19:24:02 | serhiy.storchaka | set | messageid: <1380482642.92.0.440951147189.issue19131@psf.upfronthosting.co.za> |
2013-09-29 19:24:02 | serhiy.storchaka | link | issue19131 messages |
2013-09-29 19:24:02 | serhiy.storchaka | create | |
|