Title: Allow specifying code packing order in audioop adpcm functions
Type: behavior Stage:
Components: Versions: Python 3.8, Python 3.7, Python 3.6, Python 3.5, Python 3.4
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: MosesofEgypt
Priority: normal Keywords:

Created on 2017-11-10 23:40 by MosesofEgypt, last changed 2017-11-18 18:02 by MosesofEgypt.

File name Uploaded Description Edit MosesofEgypt, 2017-11-10 23:40 Zip containing an audio file and script to reproduce the issue
Messages (2)
msg306063 - (view) Author: MosesofEgypt (MosesofEgypt) * Date: 2017-11-10 23:40
--- Issue ---
audioop.adpcm2lin and audioop.lin2adpcm currently treat the high 4 bits of each byte as the first code and the low 4 as the second code. In practice this is often the opposite.

--- Steps to reproduce ---
Run the attached script to decompress the attached wav to two different 16bit signed pcm wav files. The "GOOD" one had the nibbles of each code swapped before being decoded, while the "BAD" one didnt.

--- Suggested fix ---
I propose an additional optional boolean parameter to these functions to specify which nibble is the first code and which is the second.

NOTE: I haven't compiled my changes to test as I do not know how to set up a cpython build environment. This commit is more intended to show how to implement the fix.
msg306488 - (view) Author: MosesofEgypt (MosesofEgypt) * Date: 2017-11-18 18:02
Changed type to behavior as this is more of a bug fix than an enhancement.
Date User Action Args
2017-11-18 18:02:04MosesofEgyptsettype: enhancement -> behavior
messages: + msg306488
2017-11-10 23:40:07MosesofEgyptcreate